That's about PMD static analyzer's feature: Copy-Paste Detector.
Yes, I read http://pmd.sourceforge.net/cpd.html thoroughly.
But if I run CPD from ant-task, I can fine-tune its work by specifying ignoreLiterals
and ignoreIdentifiers
. How can I specify these keys using command-line?
I think it's currently not possible (with pmd 4.2.6 and pmd 4.1.1).
A simple
Properties
object contains theignoreLiterals
andignoreIdentifiers
settings, but the command lineCPD.main()
method does not pass any Properties object to theLanguageFactory
as the ant task (CPDTask
) does. Furthermore, if I'm correct, theCPDTask
pass these properties to theLanguageFactory.createLanguage(String language, Properties properties)
method, but this method does not use the properties argument. So, IMO theignoreLiterals
andignoreIdentifiers
settings are ignored by the ant task.Here is an old issue about this, which is still open. The patch looks correct, maybe it still works. Unfortunately it does not contain any fixes for the command line
CPD
class. Perhaps it fixes the ant task. Anyway, if you really need this functionality it does not look too hard to fix these issues.