Tuesday, November 5, 2013

Suppressing PMD & Findbugs rules

PMD 


PMD rules can be suppress by using the @SuppressWarnings("PMD") annotation.
A specific rule can also be set on the annotation @SuppressWarnings("PMD.[rule]").
For ex.


A list of rules supported by PMD can be found at : PMD Rules

Findbugs

To use the Findbugs @SupressWarnings, you've to include the following dependency -

<dependency>
 <groupId>com.google.code.findbugs</groupId>
 <artifactId>annotations</artifactId>
 <version>2.0.2</version>
</dependency>

Note: The @edu.umd.cs.findbugs.annotations.SuppressWarnings annotation is different from @java.lang.SupressWarnings annotation.

Usage :

@SupressWarnings("RULE")
A list of bugs can be found at : Findbugs

No comments:

Post a Comment