powershell/PSAvoidExclaimOperator is a PSScriptAnalyzer diagnostic emitted by tally for PowerShell snippets embedded in Dockerfiles.
Description
Avoid using the negation operator (!). Use -not for improved readability.
Upstream PSScriptAnalyzer does not enable this rule by default. Configure
rules.powershell.PSAvoidExclaimOperator.Enable = true to forward the
upstream setting to PSScriptAnalyzer.How to Fix
Replace the! negation operator with the PowerShell -not operator.
Examples
Problematic code
Correct code
Configuration
Upstream PSScriptAnalyzer supports the following rule setting. tally forwards matchingrules.powershell.PSAvoidExclaimOperator options to
PSScriptAnalyzer.
Parameters
-
Enable: bool (Default value is$false) Enable or disable the rule during ScriptAnalyzer invocation.