Skip to content

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

Closed
@essentialexch

Description

@essentialexch

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions