★ wanayoo — archive 1999 https://github.com/PowerShell/PSScriptAnalyzer/issues/905Nouvelle recherche | Portail wanayoo
Skip to content
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

Enhancement request: Suppress rules on a per-statement and/or per-block basis #905

Closed
essentialexch opened this issue Feb 21, 2018 · 2 comments
Closed

Comments

@essentialexch
Copy link

@essentialexch essentialexch commented Feb 21, 2018

Per https://github.com/PowerShell/PSScriptAnalyzer#suppressing-rules, rules can only be suppressed with function or class scope. I'm asking that this be extended to a per-statement and/or per-block basis.

Rationale: same as per-line suppressions in the C# compiler. :-) Sometimes a particular construct must be used. Also, PSSA has bugs (see #903 , for which a workaround was discovered, but there are not always workarounds available).
(Get-Module -ListAvailable PSScriptAnalyzer).Version | ForEach-Object { $_.ToString() }

Environment data

PS C:\Users\michael> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.16299.98
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.16299.98
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

> (Get-Module -ListAvailable PSScriptAnalyzer).Version | ForEach-Object { $_.ToString() }

1.16.1
@bergmeister
Copy link
Collaborator

@bergmeister bergmeister commented Feb 21, 2018

@swngdnz A similar idea was already proposed here. I agree with your idea to be able to suppress it for the next line/statement/scriptblock or even to turn it on and off for a few lines. I think I will create a meta-issue to collect all those ideas at some point an summarise it in one issue.

@bergmeister
Copy link
Collaborator

@bergmeister bergmeister commented Nov 21, 2018

Closing as duplicate of #849 now

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

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.