Back to all rules
What this rule checks
Uses a loop
Configuration
When off, this rule is excluded from pipeline runs. Changes apply immediately.
Code Examples
PASS — this code satisfies the rule
void setup() {
  size(400, 400);
}

void draw() {
  background(255);
  for (int i = 0; i < 4; i++) {
    ellipse(50 + i * 100, 200, 30, 30);
  }
}
FAIL — this code triggers the rule
void setup() {
  size(400, 400);
}

void draw() {
  background(255);
  ellipse(50, 200, 30, 30);  // the same line repeated instead of a loop
  ellipse(150, 200, 30, 30);
  ellipse(250, 200, 30, 30);
  ellipse(350, 200, 30, 30);
}
Overview
Category Topic Iteration
Level Basic
Type Custom Zita
Priority 3 (1 = highest, 5 = lowest)
Status Active
PMD Configuration
Java class nl.utwente.processing.pmd.rules.HasLoopRule
Message template Few or no loops found in the code.