All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.sonar.l10n.javascript.rules.javascript.S1994.html Maven / Gradle / Ivy

There is a newer version: 10.20.0.29356
Show newest version

Why is this an issue?

It can be extremely confusing when a for loop’s counter is incremented outside of its increment clause. In such cases, the increment should be moved to the loop’s increment clause if at all possible.

Noncompliant code example

for (i = 0; i < 10; j++) { // Noncompliant
  // ...
  i++;
}

Compliant solution

for (i = 0; i < 10; i++, j++) {
  // ...
}

Or

for (i = 0; i < 10; i++) {
  // ...
  j++;
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy