Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PSScriptAnalyzer: Enable default rules #491

Closed
SSvilen opened this issue Aug 25, 2019 · 4 comments · Fixed by #492
Closed

PSScriptAnalyzer: Enable default rules #491

SSvilen opened this issue Aug 25, 2019 · 4 comments · Fixed by #492
Labels
bug The issue is a bug. good first issue The issue should be easier to fix and can be taken up by a beginner to learn to contribute on GitHub

Comments

@SSvilen
Copy link
Contributor

SSvilen commented Aug 25, 2019

I have noticed that the default rules for PSScriptAnalyzer were not enabled, although a bunch of them are part of IncludeRules array.
Adding following line in analyzersettings.psd1 would enable them:
IncludeDefaultRules = $true

@johlju
Copy link
Member

johlju commented Aug 26, 2019

I thought using IncludeRules added them.

When you use the CustomizedRulePath parameter, you can use this parameter to include standard rules and rules in the custom rule paths.
https://github.com/PowerShell/PSScriptAnalyzer/blob/master/docs/markdown/Invoke-ScriptAnalyzer.md

You mean that the above quote assumes the IncludeDefaultRules = $true have been added?

I see under CustomRulePath that it says

Uses only the custom rules defined in the specified paths to the analysis. To still use the built-in rules, add the -IncludeDefaultRules switch.

@johlju
Copy link
Member

johlju commented Aug 26, 2019

I tested this and I agree. It does not hit the rules in the include list. Great catch @SSvilen! 😃

@johlju johlju added bug The issue is a bug. good first issue The issue should be easier to fix and can be taken up by a beginner to learn to contribute on GitHub help wanted The issue is up for grabs for anyone in the community. labels Aug 26, 2019
@SSvilen
Copy link
Contributor Author

SSvilen commented Aug 26, 2019

I have the PR waiting on submit button. :)

@johlju
Copy link
Member

johlju commented Aug 26, 2019

Happy to merge when you send it in :)

johlju pushed a commit that referenced this issue Aug 26, 2019
- Changes to ActiveDirectoryDsc
  - Enable PSSCriptAnalyzer default rules (issue #491).
@johlju johlju removed the help wanted The issue is up for grabs for anyone in the community. label Aug 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue is a bug. good first issue The issue should be easier to fix and can be taken up by a beginner to learn to contribute on GitHub
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants