Customizing PMD rules on NetBeans 6.5

In previous article we have shown how to install and run PMD plugin in NetBeans and how to interpret the analysis report. In this tutorial we will show how to choose rules that are applicable to our project and how to define our own rules if predefined doesn’t satisfy our need.

Choosing Applicable Rules

To access PMD options, go to Tools -> Options -> Miscellaneous and choose PMD tab:

pmd2-1

Enable Scan enables automatic project scanning in regular intervals. In the help file there is a reference for scanning interval too, but it was not present on my version of plugin.

Clicking on Manage Rules leads to the dialog that allows enabling or disabling specific rules. By clicking on < and > we’re moving selected rules to set of enabled or disabled rules. Clicking on << and >> will enable/disable all rules.

pmd2-2

Clicking on the rule name will show short rationale and an example of the problem that rule addresses:

pmd2-3Rulesets

Clicking on Manage Rulesets allows us to import entire rulesets in either xml file or as a .jar file. For more documentation about ruleset creation, please consult PMD web site.

pmd2-4

Conclusion

We have shown how to add PMD plugin to NetBeans and how to choose which rules to apply on our project. By adding PMD to our toolbox we can deliver products of higher quality, faster.

Useful Links

Install and Use PMD plugin on NetBeans 6.5

About these ads

One response to “Customizing PMD rules on NetBeans 6.5

  1. Pingback: Code Quality Tools in Java « Find Time for Java and more!

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 )

Google+ photo

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

Connecting to %s