- Notifications
You must be signed in to change notification settings - Fork407
PSReviewUnusedParameter false positive for ValueFromPipeline#2072
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
PSReviewUnusedParameter false positive for ValueFromPipeline#2072
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Uh oh!
There was an error while loading.Please reload this page.
Head branch was pushed to by a user without write access
bergmeister left a comment• edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
LGTM, thanks, retriggered CI
…t directly contains variable usage of $_ or $PSItem. Then when we encounted a parameter with ValueFromPipeline set, we consider whether we saw usage within a process block by automatic variable.
Co-authored-by: Andy Jordan <2226434+andyleejordan@users.noreply.github.com>
95e1486 tod83b1d9Compare1d394ee intoPowerShell:mainUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
PR Summary
Whether good practice or not, a parameter defined with
ValueFromPipelineis flagged as unused when referred to by$_or$PSItemwithin the process block of a function.This PR checks for
ValueFromPipelinewhen the parameter's usage is inspected. If set,$_and$PSItemcount towards it's usage when seen in a process block.Fixes#1840
PR Checklist
.cs,.ps1and.psm1files have the correct copyright headerWIP:to the beginning of the title and remove the prefix when the PR is ready.