Remove dead code in PMDCommandLineInterface

This commit is contained in:
Clément Fournier
2020-08-28 13:59:13 +02:00
parent 32698d8c6b
commit 986b39208f

View File

@ -41,12 +41,12 @@ public final class PMDCommandLineInterface {
jcommander.parse(args);
if (arguments.isHelp()) {
jcommander.usage();
System.out.println(buildUsageText(jcommander));
System.out.println(buildUsageText());
setStatusCodeOrExit(NO_ERRORS_STATUS);
}
} catch (ParameterException e) {
jcommander.usage();
System.out.println(buildUsageText(jcommander));
System.out.println(buildUsageText());
System.err.println(e.getMessage());
setStatusCodeOrExit(ERROR_STATUS);
}
@ -54,19 +54,6 @@ public final class PMDCommandLineInterface {
}
public static String buildUsageText() {
return buildUsageText(null);
}
public static String buildUsageText(JCommander jcommander) {
StringBuilder usage = new StringBuilder();
StringBuilder allCommandsDescription = new StringBuilder();
if (jcommander != null && jcommander.getCommands() != null) {
for (String command : jcommander.getCommands().keySet()) {
allCommandsDescription.append(jcommander.getCommandDescription(command)).append(PMD.EOL);
}
}
// TODO: Externalize that to a file available within the classpath ? -
// with a poor's man templating ?
String fullText = PMD.EOL + "Mandatory arguments:" + PMD.EOL + "1) A java source code filename or directory"
@ -77,18 +64,17 @@ public final class PMDCommandLineInterface {
fullText += supportedVersions() + PMD.EOL;
if (allCommandsDescription.length() != 0) {
fullText += "Optional arguments that may be put before or after the mandatory arguments: " + PMD.EOL
+ allCommandsDescription + PMD.EOL;
}
fullText += "Available report formats and their configuration properties are:" + PMD.EOL + getReports()
+ PMD.EOL + getExamples() + PMD.EOL + PMD.EOL + PMD.EOL;
fullText += usage.toString();
return fullText;
}
@Deprecated
public static String buildUsageText(JCommander jcommander) {
return buildUsageText();
}
private static String getExamples() {
return getWindowsExample() + getUnixExample();
}