PowerShell / PSScriptAnalyzer

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

Do rules need to be prefixed with `PS` in `*.psd1` settings file? #1868

Closed metablaster closed 1 year ago

metablaster commented 1 year ago

I've been reading rules documentation here

What is unclear to me is how rules are named without PS prefix, for example instead of PSAvoidUsingEmptyCatchBlock rule is documented as AvoidUsingEmptyCatchBlock

I keep my own settings file where all the rules are prefixed with PS, however since version 1.21.0 rules are no longer prefixed, a few new rules in this version are:

AvoidUsingDoubleQuotesForConstantString
UseUsingScopeModifierInNewRunspaces
AvoidSemicolonsAsLineTerminators

So how do I put these rules into *.psd1 settings file? do I prefix them with PS or not?

metablaster commented 1 year ago

With a bit of testing, I figured out all rules need to be prefixed with PS