Unused label should be removed

  • UNUSED_LABEL
  • Code Quality
  • Low

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

outmost: { // UNUSED_LABEL alarm
    while (true) {
        if (finishNow) break;
        else if (updateLastAndFinish) break;
        updateState();
    }
    updateLast();
}

Compliant Code Example

outmost: {
    while (true) {
        if (finishNow) break outmost;
        else if (updateLastAndFinish) break;
        updateState();
    }
    updateLast();
}

Version

This rule was introduced in DeepScan 1.8.0-beta.