Back to all rules
What this rule checks
At least one local variable is declared (Q3.5) — distinct from fields
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);
  float d = dist(mouseX, mouseY, 200, 200);  // a local, declared inside draw()
  ellipse(200, 200, d, d);
}
FAIL — this code triggers the rule
float d = 0;  // a global, not a local

void setup() {
  size(400, 400);
}

void draw() {
  background(255);
  d = dist(mouseX, mouseY, 200, 200);
  ellipse(200, 200, d, d);
}
Overview
Category Topic Variables
Level Basic
Type Custom Zita
Priority 3 (1 = highest, 5 = lowest)
Status Active
PMD Configuration
Java class nl.utwente.processing.pmd.rules.HasLocalVarDeclRule
Message template No local variable declaration found.