FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

ReviewUnusedParameter: Do not trigger when MyInvocation.BoundParameters or PSCmdlet.MyInvocation.BoundParameters is used by jegannathanmaniganadan · Pull Request #1520 · PowerShell/PSScriptAnalyzer · GitHub

ReviewUnusedParameter: Do not trigger when MyInvocation.BoundParameters or PSCmdlet.MyInvocation.BoundParameters is used - #1520

Merged
Christoph Bergmeister (bergmeister) merged 7 commits into
PowerShell:masterfrom
jegannathanmaniganadan:master
Jun 14, 2020
Merged

ReviewUnusedParameter: Do not trigger when MyInvocation.BoundParameters or PSCmdlet.MyInvocation.BoundParameters is used#1520
Christoph Bergmeister (bergmeister) merged 7 commits into
PowerShell:masterfrom
jegannathanmaniganadan:master

Conversation

Manigandan Jegannathan (jegannathanmaniganadan) commented Jun 11, 2020
edited
Loading

Copy link
Copy Markdown
Contributor

PR Summary

PR Checklist

Deleted user (ghost) commented Jun 11, 2020
edited by ghost
Loading

Copy link
Copy Markdown


All CLA requirements met.

Christoph Bergmeister (bergmeister) left a comment
edited
Loading

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Thanks. Implementation looks good to me, just a minor suggestion.
Every new feature or fix needs to be accompanied by one or more test cases though. If you look qt the existing tests, it should be very easy to add 2 tests for the cases that you added:

It "has no violations when using PSBoundParameters" {
$ScriptDefinition = 'function Bound { param ($Param1) Get-Foo @PSBoundParameters }'
$Violations = Invoke-ScriptAnalyzer -ScriptDefinition $ScriptDefinition -IncludeRule $RuleName
$Violations.Count | Should -Be 0
}

Also, when you use a closing keyword in the PR description it will close the referenced issue
https://help.github.com/en/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword

Comment thread Rules/ReviewUnusedParameter.cs Outdated

Rob Holt (rjmholt) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM, with two small comments

Comment thread Rules/ReviewUnusedParameter.cs Outdated
- Add pester tests

Copy link
Copy Markdown
Contributor Author

Thanks both for your feedback. Christoph Bergmeister (@bergmeister) did not approve the PR, so requested review again.

Every new feature or fix needs to be accompanied by one or more test cases though. If you look qt the existing tests, it should be very easy to add 2 tests for the cases that you added:

Writing pester tests for testing PSSA rule behavior is the most easiest job I have come across :)

Christoph Bergmeister (bergmeister) changed the title ReviewUnusedParameter Bug Fix ReviewUnusedParameter: Do not trigger when MyInvocation.BoundParameters or PSCmdlet.MyInvocation.BoundParameters is used Jun 14, 2020

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Thanks, looks good 😊

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PSReviewUnusedParameter has false positive when using $MyInvocation.BoundParameters

3 participants


Back | FazBrowse Home | New Git URL