Back to all rules
What this rule checks
Drawing calls use variables instead of hardcoded pixel values
Configuration
When off, this rule is excluded from pipeline runs. Changes apply immediately.
Code Examples
PASS — this code satisfies the rule
int ballX = 200;
int ballY = 150;
void draw() {
  ellipse(ballX, ballY, 50, 50);
}
FAIL — this code triggers the rule
void draw() {
  ellipse(200, 150, 50, 50);
  // hardcoded pixel values
}
Overview
Category Topic Variables
Level Intermediate
Type Custom Zita
Priority 3 (1 = highest, 5 = lowest)
Status Active
PMD Configuration
Java class nl.utwente.processing.pmd.rules.PixelHardcodeIgnoranceRule
Message template Do not use literals for pixels for {0} inside function {1}.