Tip: How to Easily Customize PMD Rules in Eclipse
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