Change return code to zero for CPD when the help command is requested through the CLI.
This commit is contained in:
@ -26,8 +26,9 @@ import com.beust.jcommander.ParameterException;
|
||||
public final class CPDCommandLineInterface {
|
||||
private static final Logger LOGGER = Logger.getLogger(CPDCommandLineInterface.class.getName());
|
||||
|
||||
private static final int DUPLICATE_CODE_FOUND = 4;
|
||||
public static final int NO_ERRORS_STATUS = 0;
|
||||
private static final int ERROR_STATUS = 1;
|
||||
private static final int DUPLICATE_CODE_FOUND = 4;
|
||||
|
||||
public static final String NO_EXIT_AFTER_RUN = "net.sourceforge.pmd.cli.noExit";
|
||||
public static final String STATUS_CODE_PROPERTY = "net.sourceforge.pmd.cli.status";
|
||||
@ -66,7 +67,7 @@ public final class CPDCommandLineInterface {
|
||||
if (arguments.isHelp()) {
|
||||
jcommander.usage();
|
||||
System.out.println(buildUsageText());
|
||||
setStatusCodeOrExit(ERROR_STATUS);
|
||||
setStatusCodeOrExit(NO_ERRORS_STATUS);
|
||||
return;
|
||||
}
|
||||
} catch (ParameterException e) {
|
||||
|
@ -111,8 +111,7 @@ public class BinaryDistributionIT {
|
||||
ExecutionResult result;
|
||||
|
||||
result = CpdExecutor.runCpd(tempDir, "-h");
|
||||
|
||||
result.assertExecutionResult(1, "Supported languages: [apex, cpp, cs, dart, ecmascript, fortran, go, groovy, java, jsp, kotlin, lua, matlab, objectivec, perl, php, plsql, python, ruby, scala, swift, vf]");
|
||||
result.assertExecutionResult(0, "Supported languages: [apex, cpp, cs, dart, ecmascript, fortran, go, groovy, java, jsp, kotlin, lua, matlab, objectivec, perl, php, plsql, python, ruby, scala, swift, vf]");
|
||||
|
||||
result = CpdExecutor.runCpd(tempDir, "--minimum-tokens", "10", "--format", "text", "--files", srcDir);
|
||||
result.assertExecutionResult(4, "Found a 10 line (55 tokens) duplication in the following files:");
|
||||
|
Reference in New Issue
Block a user