org.sonar.education.2completelyDifferentSnippets.html Maven / Gradle / Ivy
Example with 2 completely different code snippets
Noncompliant Code Example
while (true) { // Noncompliant; constant end condition
j++;
}
var k;
var b = true;
while (b) { // Noncompliant; constant end condition
k++;
}
Compliant Solution
while (true) { // break will potentially allow leaving the loop
var x = 3;
for(let i=2; i<4; i++) {
console.log("Hello there");
}
alert('Click here');
thisIsNiceFunction();