★ wanayoo — archive 1999 https://github.com/PowerShell/PSScriptAnalyzer/issues/578Nouvelle recherche | Portail wanayoo
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

Deprecated Rules should be included and be available to call manually #578

Open
kilasuit opened this issue Jul 6, 2016 · 4 comments
Open

Deprecated Rules should be included and be available to call manually #578

kilasuit opened this issue Jul 6, 2016 · 4 comments

Comments

@kilasuit
Copy link
Contributor

@kilasuit kilasuit commented Jul 6, 2016

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

Invoke-ScriptAnalyzer -DeprecatedRule AvoidUninitializedVariable

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

Get-ScriptAnalyzerRule -DeprecatedRules

I would expect that the above would just return the deprecated rules

Is this something that would be useful to others as well?

@pauby
Copy link
Contributor

@pauby pauby commented Jul 7, 2016

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:

PSAvoidUnintializedVariables

to

PSDeprecated_AvoidUninitializedVariables

@kapilmb
Copy link

@kapilmb kapilmb commented Jul 18, 2016

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.

@kapilmb kapilmb added this to the backlog milestone Jul 19, 2016
@kilasuit
Copy link
Contributor Author

@kilasuit kilasuit commented Sep 13, 2018

Has this functionality now changed @bergmeister ??

@bergmeister
Copy link
Collaborator

@bergmeister bergmeister commented Sep 13, 2018 •

@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 AvoidUninitializedVariables rule has been superseded by UseDeclaredVarsMoreThanAssignments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.