Back to all rules
What this rule checks
At least one event handler calls a user-declared method (Q5.3)
Configuration
When off, this rule is excluded from pipeline runs. Changes apply immediately.
Code Examples
PASS — this code satisfies the rule
float x = 0;

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

void draw() {
  background(255);
  x = x + 2;
  ellipse(x, 200, 20, 20);
}

void resetBall() {
  x = 0;
}

void mousePressed() {
  resetBall();
}
FAIL — this code triggers the rule
float x = 0;

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

void draw() {
  background(255);
  x = x + 2;
  ellipse(x, 200, 20, 20);
}

void mousePressed() {
  x = 0;  // does the work inline, calls none of your functions
}
Overview
Category Topic Event Handling
Level Intermediate
Type Custom Zita
Priority 3 (1 = highest, 5 = lowest)
Status Active
PMD Configuration
Java class nl.utwente.processing.pmd.rules.HasUserCallInsideEHRule
Message template No event handler calls any user-declared method.