Skip to content

False positive on 'PSUseApprovedVerbs' when scope is declared as a prefix to the Verb-Noun combination #473

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

Closed
Meglomax opened this issue Mar 22, 2016 · 7 comments

Comments

@Meglomax
Copy link

Reference message: "The cmdlet 'Local:Test-Something' uses an unapproved verb."

Where Advanced Functions are declared with a scope prefix the rule generates a false positive.

For example:
Function Local:Test-Something {...}
Function Script:Test-SomethingElse {...}
etc.. same for Global and Private.

Not trying to justify the syntax or the appropriate use cases for it. The syntax is however supported by PowerShell, and when used to declare the function the rule clearly generates a false positive (noting that without the scope prefix these Verb-Noun combinations pass the rule).

@kilasuit
Copy link
Contributor

Which Version of PSScriptAnalyzer are you using as this was assumed fixed in #424 as was raised in #415 and should be included in version 1.4.0

@Meglomax
Copy link
Author

Downloaded PSScriptAnalyzer for the first time earlier this evening - ModuleVersion = '1.4.0'.

@kilasuit
Copy link
Contributor

I see the issue here.

If you have local:Test-Something it wont fire the issue but Local:Test-Something does.

Will get this fixed with another PR shortly

@kilasuit
Copy link
Contributor

This should be accepted and fixed via #474 but in the mean time if you use the lowercase version "local:Test-Something" this will work as expected

@Meglomax
Copy link
Author

Understood and thanks!

Forgive the noobie question, should I close the issue now or will it be closed when the defect has been addressed in the source code?

@KirkMunro
Copy link
Contributor

You should leave the issue open. They'll close it when the defect has been fixed.

@Meglomax
Copy link
Author

Thanks, Kirk. Got it ;)

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

No branches or pull requests

3 participants