CPD Ant Task: Add ignoreUsings option

This commit is contained in:
Andreas Dangel
2015-10-26 20:36:07 +01:00
parent 88634a220a
commit 2fa869a868
2 changed files with 16 additions and 0 deletions

View File

@ -47,6 +47,7 @@ public class CPDTask extends Task {
private boolean ignoreLiterals; private boolean ignoreLiterals;
private boolean ignoreIdentifiers; private boolean ignoreIdentifiers;
private boolean ignoreAnnotations; private boolean ignoreAnnotations;
private boolean ignoreUsings;
private boolean skipLexicalErrors; private boolean skipLexicalErrors;
private boolean skipDuplicateFiles; private boolean skipDuplicateFiles;
private boolean skipBlocks = true; private boolean skipBlocks = true;
@ -104,6 +105,9 @@ public class CPDTask extends Task {
if (ignoreAnnotations) { if (ignoreAnnotations) {
p.setProperty(Tokenizer.IGNORE_ANNOTATIONS, "true"); 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, Boolean.toString(skipBlocks));
p.setProperty(Tokenizer.OPTION_SKIP_BLOCKS_PATTERN, skipBlocksPattern); p.setProperty(Tokenizer.OPTION_SKIP_BLOCKS_PATTERN, skipBlocksPattern);
return LanguageFactory.createLanguage(language, p); return LanguageFactory.createLanguage(language, p);
@ -188,6 +192,10 @@ public class CPDTask extends Task {
this.ignoreAnnotations = value; this.ignoreAnnotations = value;
} }
public void setIgnoreUsings(boolean value) {
this.ignoreUsings = value;
}
public void setSkipLexicalErrors(boolean skipLexicalErrors) { public void setSkipLexicalErrors(boolean skipLexicalErrors) {
this.skipLexicalErrors = skipLexicalErrors; this.skipLexicalErrors = skipLexicalErrors;
} }

View File

@ -331,6 +331,14 @@ Andy Glover wrote an Ant task for CPD; here's how to use it:
<td valign="top">java</td> <td valign="top">java</td>
<td valign="top" align="center">No</td> <td valign="top" align="center">No</td>
</tr> </tr>
<tr>
<td valign="top">ignoreUsings</td>
<td valign="top">
Ignore using directives in C#.
</td>
<td valign="top">C#</td>
<td valign="top" align="center">No</td>
</tr>
<tr> <tr>
<td valign="top">skipDuplicateFiles</td> <td valign="top">skipDuplicateFiles</td>
<td valign="top"> <td valign="top">