Closed 0x7FFFFFFFFFFFFFFF closed 1 year ago
We don't plan to remove this rule by default, but you can suppress this rule by adding -ExcludeRule PSPossibleIncorrectComparisonWithNull
to you Invoke-ScriptAnalyzer
cmdlet.
Thanks for the clarification.
Summary of the new feature
I have this code
And the analyzer tells me:
In fact, the tradition to put the value on the left side of the comparison comes from the confusion between the assignment operator and the equality operator,
=
and==
in C-like languages. In PowerShell, the assignment operator is=
, and the equality operator is-eq
. So it's impossible to confuse them. And put the variable on the left side of the comparison is more readable and natural. Should we remove this rule from the analyzer?