Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upDeprecated Rules should be included and be available to call manually #578
Comments
|
I was looking for the AvoidUninitialzedVariables rule yesterday and noticed it had been deprecated. If a rule is being deprecated, as in this case, because it's redundant (ie. replaced by another rule) then we should be able to decide whether to use it or not. I think the -DeprecatedRules switch is a great way around this. Or Alternatively just rename the rule from:
to
|
|
Yes, I agree that if a rule is deprecated, instead of removing it completely from the built-in rules, we should provide users the option of using them, though by default they will be turned off. |
|
Has this functionality now changed @bergmeister ?? |
|
@kilasuit The only deprecated rules that I can still see in the current version are here and are not compiled into PSSA. When I was looking at the history of some rules/issues previously I saw that the previous maintainers removed the source code for most of it, so we would need to dig in the git history to find the other deprecated rules. This happened before I joined and there was not rule deprecation after I've joined. Given the current state of history, I'd rather suggest to use an old version of PSSA if there is a legacy requirement since PSSA is side-by-side. Is there a specific rule that you'd like to have back? At first glance. it seems that the |
From what I can currently see the Deprecated Rules aren't being added to the released version of PSScriptAnalyzer.
As the number of rules grows and more rules get deprecated there may well be a requirement from those in the community to be able to make use of a deprecated rule in a non-standard & possibly quite an obscure manner.
I think that it would be useful for the deprecated rules to be shipped alongside the built in rules and then extend the Get-ScriptAnalyzerRule & Invoke-ScriptAnalyzer cmdlets like below
The above would enforce the user to explicitly request to have the rule run. Whether this runs alongside all the built in rules or just runs this one rule would be a decision point that would need to be made
I would expect that the above would just return the deprecated rules
Is this something that would be useful to others as well?