Skip to content

Script Analyzer test should make use of multiple custom rule paths #100

@johlju

Description

@johlju

The PSSA test source/Tests/QA/PSSAResource.common.Tests.ps1 currently ignores a repository's Script Analyzer file. I Script Analyzer file can be used to add additional custom rules that should only be run for the repository.

Script Analyzer is run with a settings file like this.

Invoke-ScriptAnalyzer -Path .\output\SqlServerDsc\15.0.1\DSCResources\**\*.psm1 -Recurse -Settings .\.vscode\analyzersettings.psd1

But a better option would be to allow custom rule paths to be specified in the build configuration file build.yml under the key DscTest: together with an option to include additional rules (if the rules are not prefixed with Measue-*).

The custom rule paths that is set must point to one or more module or module files. Since Script Analyzer must be called like this:

Invoke-ScriptAnalyzer `
    -Path .\output\SqlServerDsc\15.0.1\DSCResources\DSC_SqlTraceFlag\*.psm1 `
    -CustomRulePath @(
        '.\output\RequiredModules\DscResource.AnalyzerRules'
        '.\tests\QA\AnalyzerRules\SqlServerDsc.AnalyzerRules.psm1'
     ) `
    -IncludeRule @('Measure-*')

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementThe issue is an enhancement request.help wantedThe issue is up for grabs for anyone in the community.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions