PowerShell / PSScriptAnalyzer

Download ScriptAnalyzer from PowerShellGallery
https://www.powershellgallery.com/packages/PSScriptAnalyzer/
MIT License
1.84k stars 372 forks source link

Add baselining capability #124

Closed rkeithhill closed 9 years ago

rkeithhill commented 9 years ago

One issue I've seen with adopting code analysis / FxCop on an existing, large code base is that the number of warnings and errors can be overwhelming. Additionally, code may be released and management may frown heavily on changing existing, released code to eliminate CA warnings. Sometimes we can make the case for CA errors. However, the project could benefit from turning on CA for new code.

I believe the PowerShell ScriptAnalyzer could benefit from this approach. Folks have an existing large script base that has been working for years. Most likely they won't want to change working script to eliminate warnings. There should probably be an option to point out errors (or not) when creating the baseline. After the baseline is created, the ScriptAnalyzer would then generate warnings and errors for new script as well as modified script.

raghushantha commented 9 years ago

Hi Keith.

We are working on a new feature called ScriptAnalyzer Profiles which might be able to solve this. [more details soon..]

Essentially a user can define a profile (collection of rules+customizations from one/more containers) that fits his environment.

There will be a few inbox shipped profiles which can be used as a starting point for customization.

-Raghu

rkeithhill commented 9 years ago

Thanks. Profiles as I understand them are a bit different but also needed. In fact, I would give Profiles a higher priority than base-lining support.

raghushantha commented 9 years ago

v1 of Profiles is available in current Master branch.

Sample: https://github.com/PowerShell/PSScriptAnalyzer/blob/master/Tests/Engine/Profile.ps1