Our code gets dinged with rule java:S2589 (https://rules.sonarsource.com/java/type/Code%20Smell/RSPEC-2589?search=boolean) for something like this:
if (c || (!c && b)) …
Obviously the guilty party didn’t understand short-circuit logic, or perhaps was ordered to put in null checks (c in our case is a null check expression).
In the rule description, the non-compliant examples are rather trivial and don’t include an example like this, which is probably more relevant to what novice programmers might do.
So I think it’d be useful to add such an example, something like:
non-compliant:
if (c || (!c && b)) { // Short-circuit logic guarantees !c is true
compliant
if (c || b) {
This post specifically mentions the java repo but it would apply to any version of this rule in a language with short-circuit logic.
(Our SQ is old but the link above points to your webpage which is presumably up to date.)