The Holy Java

Building the right thing, building it right, fast

Tip: How to Easily Customize PMD Rules in Eclipse

Posted by Jakub Holý on August 21, 2012

The default PMD rules are little too strict for me (especially when starting on a legacy project) so I need to adjust them, usually by decreasing priority to warning. It’s however quite difficult to find the rule responsible for an error message unless you know how to do it. The answer is the PMD Violations Overview view, which lists the rule names (such as “ConstructorCallsOverridableMethod”, as opposed to the error message such as “Overridable method ‘addSummaryPeriod’ called during object construction”).

Therefore:

  1. Window – Show View – Other… – PMD – Violations Overview
  2. In the top-right corner of the Violations Overview view, select e.g. only the priority 1 and 2 warnings by clicking the colored circles representing the other priorities.
  3. Expand the list down to the rule name level to find the rules you want to change
  4. Eclipse configuration: PMD – Rules Configuration – click on “Rule name” column to sort the rules by name, find the rule

Eclipse 3.7, PMD plugin 3.2.6.

About these ads

One Response to “Tip: How to Easily Customize PMD Rules in Eclipse”

  1. [...] PMD Rules in Eclipse « The Holy Java Posted: August 23, 2012 in Web & Cloud 0 Tip: How to Easily Customize PMD Rules in Eclipse « The Holy Java. Share this:LinkedInTwitterDiggBloggerLike this:LikeBe the first to like [...]

Sorry, the comment form is closed at this time.

 
%d bloggers like this: