The Holy Java

Notes of a passionate Java EE developer

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 [...]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: