If an expression doesn't change the evaluation of the condition, then it is either unnecessary, and condition can be removed, or it makes some code being never executed. In any case, the code should be refactored.

## Noncompliant Code Example

    function checkState(state: boolean) {
      if (state) {
        console.log("Checking the state");
        if (state) { // Noncompliant, condition is always true
          doSomething();
        }
      }
    }

## Compliant Solution

    function checkState(state: boolean) {
      if (state) {
        console.log("Checking the state");
        if (shouldDoSomething()) {
          doSomething();
        }
      }
    }

## See

- MISRA C:2004, 13.7 - Boolean operations whose results are invariant shall not be permitted.
- MISRA C:2012, 14.3 - Controlling expressions shall not be invariant
- MITRE, CWE-489 - Leftover Debug Code
- MITRE, CWE-571 - Expression is Always True
- CERT, MSC12-C. - Detect and remove code that has no effect or is never executed