Skip to content

Difficulty in identifying the source of functions used in a project #46

@ahpooch

Description

@ahpooch

When studying DSC repositories, at first I have encountered difficulties in determining where certain custom functions or cmdlets in the code come from. Can we do something to make this easier for other contributors?

Let’s examine the issue using an example from this repository (DscResource.Base).
In the file source\Classes\010.ResourceBase.ps1, among others, the following cmdlets are used:

  • Get-DscProperty
  • Test-DscProperty
  • Compare-DscParameterState

In some DSC repositories, I’ve seen annotations in .NOTES that help identify where a function or cmdlet is defined, like this:

Used Functions:  
            Name                                | Module  
            ---------------------------------   |--------------------------  
            Get-DscProperty                     | DscResource.Common  
            Test-DscProperty                    | DscResource.Common  
            Compare-DscParameterState           | DscResource.Common  

Initially, I wanted to create a PR modifying 010.ResourceBase.ps1 by adding the changes to the .NOTES section as described above. However, this approach could create unnecessary maintenance overhead. Even if we only document the sources of cmdlets from external modules, these informational blocks would need to be added to every file that uses external cmdlets.

That said, simply ensuring that information about external cmdlets can be found via a global search across the module’s files would already greatly improve the situation.
To achieve this, we could:

  • Add a dedicated section in README.md,
  • Create a separate file (e.g., ExternalFunctions.md), or
  • Include the information in RequiredModules.psd1.

Personally, I think a separate, well-structured file in the repository’s root would be more convenient and useful than the other options.
It could be named like

  • DEPENDENCIES.md
  • EXTERNAL-FUNCTIONS.md
  • EXTERNAL-MODULES.md
  • USED-MODULES.md
  • MODULES-USED.md
  • FUNCTION-REFERENCES.md
  • MODULES-REFERENCES.md
    etc.

I’d like to hear the maintainers’ opinions on this issue before submitting a PR on this topic.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions