Is there a way to tell PMD to ignore checking parts of code for duplication?
For example, can I do something like this:
// CPD-Ignore-On
...
// CPD-Ignore-Off
Currently I have PMD set up like this using Maven, but don't see any arguments that would like me do what I want unless I am missing something.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>2.5</version>
<configuration>
<minimumTokens>40</minimumTokens>
<targetJdk>1.5</targetJdk>
<ignoreIdentifiers>true</ignoreIdentifiers>
<ignoreLiterals>true</ignoreLiterals>
</configuration>
</plugin>
After digging around enough, I finally came across it.
By adding the annotations @SuppressWarnings("CPD-START")
and @SuppressWarnings("CPD-END")
all code within will be ignored by CPD - thus you can avoid false positives.
Source - http://pmd.sourceforge.net/pmd-5.0.5/cpd-usage.html.