Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Interview: PMD Code Analyzer for NetBeans IDE

DZone's Guide to

Interview: PMD Code Analyzer for NetBeans IDE

· Java Zone ·
Free Resource

The CMS developers love. Open Source, API-first and Enterprise-grade. Try BloomReach CMS for free.

Gianluca Costa is a software developer from Italy. Creating software is both his job and passion. His favorite areas of interest in the IT sector are software engineering, programming languages, and build infrastructures.

He's also the author of EasyPmd, a NetBeans plugin that can be downloaded here:

http://plugins.netbeans.org/plugin/52534/easypmd-4

Hi Gianluca. What is EasyPmd?

EasyPmd is a plugin that integrates the PMD code analyzer into NetBeans IDE.

In other words, it scans source files for violations of style rules that the developer has chosen to apply and reports the results both in the Action items window and in the code editor itself, so as to provide complete and updated monitoring.



(Click the image above to enlarge it.)

How is EasyPmd different to FindBugs and other similar tools?


EasyPmd enables developers to employ PMD within NetBeans IDE, which means that, for example, acquired knowledge such as custom rules and rule sets created for PMD in other contexts, such as Ant and Maven, can be easily reused in the visual environment of the IDE.

Furthermore, anyone interested in PMD can quickly try it out in NetBeans IDE using EasyPmd.

That said, the choice of tools mainly depends on the developer's personal preferences and on their business requirements.

Can you name some specific EasyPmd features that you are especially happy or proud of?

Apart from the basic idea around which EasyPmd revolves, that is, the centralized reporting of PMD violations and the glyphs shown next to code editor lines causing such violations, I'd say that my favourite features are:
  • Visual customization of rulesets and of the related classpath. EasyPmd enables you to add rulesets by letting you choose among the predefined ones provided by PMD, as well as to add your own rulesets. In this case, the management of the required classpath is greatly simplified by the visual user interface.
  • Regex-based scanning. One can tell EasyPmd which files to include into or exclude from scanning, on the basis of regular expressions. A predefined set of regexes, covering the most common cases, is provided, both as examples and to simplify the task.
  • Profiles. Developers can create as many profiles as they want, and every profile contains a fully-customized set of all the plugin options that can be changed just by switching to another profile.
  • Flexibility. EasyPmd's options let you configure both the underlying PMD engine and the plugin itself, for example, how violations are reported.


  • Speed and reliability. EasyPmd is fast, as it's based on a 2-level cache (both in memory and on disk), and it's becoming more and more robust, release after release.
How does one get started with EasyPmd?

EasyPmd should appear in the Available Plugins list in the NetBeans Plugin Manager in NetBeans IDE 7.4.



Furthermore, I have published a Getting Started Tutorial, currently in English and French, to explain in detail how to install EasyPmd and how to get started with it.

http://gianlucacosta.info/software/easypmd/?tab=tabs-videos

The videos above are shown in the videos section of EasyPmd's home page.

Finally, for those wishing to employ custom rulesets, I have updated the article "Writing custom rulesets for EasyPmd", which explains how to create a new ruleset and how to plug it into EasyPmd 4.

BloomReach CMS: the API-first CMS of the future. Open-source & enterprise-grade. - As a Java developer, you will feel at home using Maven builds and your favorite IDE (e.g. Eclipse or IntelliJ) and continuous integration server (e.g. Jenkins). Manage your Java objects using Spring Framework, write your templates in JSP or Freemarker. Try for free.

Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}