-
Notifications
You must be signed in to change notification settings - Fork 393
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
Update PSAvoidAssignmentToAutomaticVariable to detect more automatic variables #1183
Comments
The reason why it flags the readonly ones at the moment is because one can be sure that assignment to those does not make sense. There are built in variables that can be assigned to by fesign, therefore we cannot just flag against all of those. But there are certainly a few more variables that we could add to the list, the work just has not been done yet to determine which other variables we should also warn against. I'd be happy to discuss it if someone like you does the research and adds more variables to it. The |
I logged this because it did not flag $Matches variable. Why can't we make it configurable. |
Ideally, we should just add the variables that we sure of should not be modified to the blacklist so that everyone can benefit from it but having an optional configuration that allows to add more variables would be possible as well. Feel free to create a PR either |
I think this rule detects only limited number of automatic variables, we should probably update this with https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_automatic_variables?view=powershell-6
I am not sure whats the reason behind having only limited number of variables (may be they are read-only ?). But the rule name conveys different meaning.
We should change the rule name or let it flag all the automatic variable or make it ConfigurableRule
The text was updated successfully, but these errors were encountered: