Compare a remainder that may be negative with zero
ProprietaryRewrites x % 2 == 1 to x % 2 != 0 when x is integral, since the remainder of a negative odd number is -1 and the original test misses it. It is marked instead when its method also compares that remainder with a negative number, orders it as in x % 2 < 0 or switches on it with a negative case, since the author already tells the signs apart. Other equality tests of a remainder against a non-zero integer literal, such as x % 3 == 2 or x % 2 == -1, are marked instead, since which sign was meant is up to the author. As in SonarQube, only remainders of a method parameter, or of a field or call on one, are considered, and not those of a collection's size, a string's length or an array's length. Test sources are not changed.
io. moderne. staticanalysis. CompareRemainderWithZeromod run . --recipe= io. moderne. staticanalysis. CompareRemainderWithZeroInstall it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.