Inspectopedia
 
2024.3

Constant on wrong side of comparison

Warning
New
Last modified: 03 December 2024

Reports comparison operations where the constant value is on the wrong side.

Some coding conventions specify that constants should be on a specific side of a comparison, either left or right.

Example:

After the quick-fix is applied:

Use the inspection settings to choose the side of constants in comparisons and whether to warn if null literals are on the wrong side.

New in 2019.2