Unused label should be removed

  • UNUSED_LABEL
  • Code Quality
  • Low
  • No tags

This rule applies when labels are declared but not used.

For maintainability, it is recommended to remove unused code. Also, it might be a mistake that a programmer forgets to use the declared label.

Noncompliant Code Example

View with compliant examples side by side
outmost: { // UNUSED_LABEL alarm
    while (true) {
        if (finishNow) break;
        else if (updateLastAndFinish) break;
        updateState();
    }
    updateLast();
}

Compliant Code Example

View with noncompliant examples side by side
outmost: {
    while (true) {
        if (finishNow) break outmost;
        else if (updateLastAndFinish) break;
        updateState();
    }
    updateLast();
}

Version

This rule was introduced in DeepScan 1.8.0-beta.

Was this documentation helpful?