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”).
- Window – Show View – Other… – PMD – Violations Overview
- 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.
- Expand the list down to the rule name level to find the rules you want to change
- 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.
One Response to “Tip: How to Easily Customize PMD Rules in Eclipse”
Sorry, the comment form is closed at this time.