Skip to content

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

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
essentialexch opened this issue Feb 21, 2018 · 2 comments

Comments

@essentialexch
Copy link

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

@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

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
Development

No branches or pull requests

2 participants