| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
…tribute that contains a Variable expression, such as '[ValidateSet($True,$False)]'.
There was a problem hiding this comment.
Thanks, looks good to me
Sorry, something went wrong.
There was a problem hiding this comment.
Thanks!
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
PR Summary
The rule PSAvoidAssignmentToAutomaticVariable alerts when no assignment has taken place.
It does so when $true or $false is used within the ValidateSet attribute of a parameter. Only the automatic variables $true and $false are permitted here - all other read-only automatic variables are a ParseError.
Currently:
Is flagged by PSAvoidAssignmentToAutomaticVariable.
This PR adds a check for variable expressions found within parameters which are the child of an Attribute, and skips them. Similarly to skipping over the variable expressions that are children of NamedAttributeArguments, which is already present.
This does not prevent the bodies of scriptblocks, within attributes, from being checked. So for instance the below is still flagged by PSAvoidAssignmentToAutomaticVariable.
Resolves #1970
PR Checklist