Inspectopedia
 
2024.3

Non-short-circuit boolean expression

Warning
New
Last modified: 03 December 2024

Reports usages of the non-short-circuit forms of boolean 'and' and 'or' (&, |, &= and |=). Although the non-short-circuit versions are occasionally useful, in most cases the short-circuit forms (&& and ||) are intended and such unintentional usages may lead to subtle bugs.

A quick-fix is suggested to use the short-circuit versions.

Example:

After the quick-fix is applied: