From 2fa869a86859052d071558d17850ac5e6b4b905c Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Mon, 26 Oct 2015 20:36:07 +0100 Subject: [PATCH] CPD Ant Task: Add ignoreUsings option --- .../src/main/java/net/sourceforge/pmd/cpd/CPDTask.java | 8 ++++++++ src/site/markdown/usage/cpd-usage.md | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/CPDTask.java b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/CPDTask.java index 8c73a15f1e..69be0f7997 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/CPDTask.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/CPDTask.java @@ -47,6 +47,7 @@ public class CPDTask extends Task { private boolean ignoreLiterals; private boolean ignoreIdentifiers; private boolean ignoreAnnotations; + private boolean ignoreUsings; private boolean skipLexicalErrors; private boolean skipDuplicateFiles; private boolean skipBlocks = true; @@ -104,6 +105,9 @@ public class CPDTask extends Task { if (ignoreAnnotations) { p.setProperty(Tokenizer.IGNORE_ANNOTATIONS, "true"); } + if (ignoreUsings) { + p.setProperty(Tokenizer.IGNORE_USINGS, "true"); + } p.setProperty(Tokenizer.OPTION_SKIP_BLOCKS, Boolean.toString(skipBlocks)); p.setProperty(Tokenizer.OPTION_SKIP_BLOCKS_PATTERN, skipBlocksPattern); return LanguageFactory.createLanguage(language, p); @@ -188,6 +192,10 @@ public class CPDTask extends Task { this.ignoreAnnotations = value; } + public void setIgnoreUsings(boolean value) { + this.ignoreUsings = value; + } + public void setSkipLexicalErrors(boolean skipLexicalErrors) { this.skipLexicalErrors = skipLexicalErrors; } diff --git a/src/site/markdown/usage/cpd-usage.md b/src/site/markdown/usage/cpd-usage.md index 8270fe3ee4..d43f8d8e30 100644 --- a/src/site/markdown/usage/cpd-usage.md +++ b/src/site/markdown/usage/cpd-usage.md @@ -331,6 +331,14 @@ Andy Glover wrote an Ant task for CPD; here's how to use it: java No + + ignoreUsings + + Ignore using directives in C#. + + C# + No + skipDuplicateFiles