Back to all rules
What this rule checks
An attribute of a user-defined class is changed somewhere in the sketch (in the class or through an object)
Configuration
When off, this rule is excluded from pipeline runs. Changes apply immediately.
Code Examples
PASS — this code satisfies the rule
class Ball {
  float x = 0;
  void move() { x = x + 2; }
  void show() { ellipse(x, 200, 20, 20); }
}
Ball b = new Ball();

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

void draw() {
  b.move();
  b.show();
}
FAIL — this code triggers the rule
class Ball {
  float x = 200;  // never changes
  void show() { ellipse(x, 200, 20, 20); }
}
Ball b = new Ball();

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

void draw() {
  b.show();
}
Overview
Category Topic Classes
Level Intermediate
Type Custom Zita
Priority 3 (1 = highest, 5 = lowest)
Status Active
PMD Configuration
Java class nl.utwente.processing.pmd.rules.ClassAttrModifyRule
Message template No class method writes to one of its own attributes.