description | ms.date | ms.topic | title |
---|---|---|---|
Avoid exclaim operator |
03/26/2024 |
reference |
AvoidExclaimOperator |
Severity Level: Warning
Avoid using the negation operator (!
). Use -not
for improved readability.
Note
This rule is not enabled by default. The user needs to enable it through settings.
$MyVar = !$true
$MyVar = -not $true
Rules = @{
PSAvoidExclaimOperator = @{
Enable = $true
}
}
-
Enable
: bool (Default value is$false
)Enable or disable the rule during ScriptAnalyzer invocation.