Applied patch 3497021 from Remi Delmas - CPD now returns non zero status if duplication is found.
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@7638 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
@ -29,6 +29,11 @@ TODO - Release blockers - Must implement before this release can be finally fini
|
||||
Fixed bug 3470274: Using Label for lines in XMLRenderer
|
||||
Fixed bug 3175710: NPE in InsufficientStringBufferDeclaration
|
||||
|
||||
|
||||
CPD:
|
||||
- Exit with status code 4 when CPD detects code duplication (Patch ID: 3497021)
|
||||
|
||||
|
||||
---
|
||||
|
||||
|
||||
|
@ -21,7 +21,8 @@ public class CPD {
|
||||
private static final int MISSING_FILES = 1;
|
||||
private static final int MISSING_ARGS = 2;
|
||||
private static final int MISSING_REQUIRED_ARGUMENT = 3;
|
||||
|
||||
private static final int DUPLICATE_CODE_FOUND = 4;
|
||||
|
||||
private Map<String, SourceCode> source = new TreeMap<String, SourceCode>();
|
||||
private CPDListener listener = new CPDNullListener();
|
||||
private Tokens tokens = new Tokens();
|
||||
@ -220,7 +221,10 @@ public class CPD {
|
||||
}
|
||||
|
||||
cpd.go();
|
||||
System.out.println(renderer.render(cpd.getMatches()));
|
||||
if(cpd.getMatches().hasNext()) {
|
||||
System.out.println(renderer.render(cpd.getMatches()));
|
||||
System.exit(DUPLICATE_CODE_FOUND);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -137,8 +137,8 @@ $ java -Xmx512m net.sourceforge.pmd.cpd.CPD --minimum-tokens 100 --files /usr/lo
|
||||
</source>
|
||||
|
||||
</subsection>
|
||||
|
||||
<p>Suggestions? Comments? Post them <a href="http://sourceforge.net/forum/forum.php?forum_id=188192">here</a>. Thanks!</p>
|
||||
<p>Please note that if CPD detects duplicated source code, it will exit with status 4 (since 5.0). This behavior has been introduced to ease CPD integration into scrips or
|
||||
hook, such as SVN hooks.</p>
|
||||
|
||||
</section>
|
||||
</body>
|
||||
|
@ -327,6 +327,7 @@
|
||||
<li>Suresh - new rule DontUseFloatTypeForLoopIndices</li>
|
||||
<li>Dinesh Bolkensteyn and SonarSource - Java 7 grammar support</li>
|
||||
<li>Tom Wheeler - contribute a launch script for CPD GUI</li>
|
||||
<li>Remi Delmas - change CPD CLI to return a non null value when code duplication is found.</li>
|
||||
</ul>
|
||||
</subsection>
|
||||
<subsection name="Organizations">
|
||||
|
Reference in New Issue
Block a user