From efd87c50e491d55cfc0dfd25d112ca02b49e513b Mon Sep 17 00:00:00 2001 From: XenoAmess Date: Wed, 26 Aug 2020 21:08:51 +0800 Subject: [PATCH 1/5] Fix a NPE created by the last pr. Sorry about that. --- .../java/net/sourceforge/pmd/cli/PMDCommandLineInterface.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/cli/PMDCommandLineInterface.java b/pmd-core/src/main/java/net/sourceforge/pmd/cli/PMDCommandLineInterface.java index 8642562b11..402b7726fd 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/cli/PMDCommandLineInterface.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/cli/PMDCommandLineInterface.java @@ -60,7 +60,7 @@ public final class PMDCommandLineInterface { public static String buildUsageText(JCommander jcommander) { StringBuilder usage = new StringBuilder(); - StringBuilder allCommandsDescription = null; + StringBuilder allCommandsDescription = new StringBuilder(); if (jcommander != null && jcommander.getCommands() != null) { for (String command : jcommander.getCommands().keySet()) { allCommandsDescription.append(jcommander.getCommandDescription(command)).append(PMD.EOL); @@ -77,7 +77,7 @@ public final class PMDCommandLineInterface { fullText += supportedVersions() + PMD.EOL; - if (allCommandsDescription != null) { + if (allCommandsDescription.length() != 0) { fullText += "Optional arguments that may be put before or after the mandatory arguments: " + PMD.EOL + allCommandsDescription + PMD.EOL; } From 32698d8c6b17c89d8a1475f73bfe5e6055d64520 Mon Sep 17 00:00:00 2001 From: XenoAmess Date: Thu, 27 Aug 2020 13:43:24 +0800 Subject: [PATCH 2/5] add unit test for the change made. --- .../pmd/cli/PMDCommandLineInterfaceTest.java | 189 ++++++++++++++++++ 1 file changed, 189 insertions(+) diff --git a/pmd-core/src/test/java/net/sourceforge/pmd/cli/PMDCommandLineInterfaceTest.java b/pmd-core/src/test/java/net/sourceforge/pmd/cli/PMDCommandLineInterfaceTest.java index ef775a2f7a..87bf10342e 100644 --- a/pmd-core/src/test/java/net/sourceforge/pmd/cli/PMDCommandLineInterfaceTest.java +++ b/pmd-core/src/test/java/net/sourceforge/pmd/cli/PMDCommandLineInterfaceTest.java @@ -6,8 +6,15 @@ package net.sourceforge.pmd.cli; import static org.junit.Assert.assertTrue; +import java.io.IOException; +import java.io.StringReader; + +import com.beust.jcommander.JCommander; + +import org.apache.commons.io.IOUtils; import org.junit.Assert; import org.junit.Before; +import org.junit.ComparisonFailure; import org.junit.Rule; import org.junit.Test; import org.junit.contrib.java.lang.system.ExpectedSystemExit; @@ -81,4 +88,186 @@ public class PMDCommandLineInterfaceTest { PMDCommandLineInterface.setStatusCodeOrExit(0); Assert.assertEquals(System.getProperty(PMDCommandLineInterface.STATUS_CODE_PROPERTY), "0"); } + + static void assertStringEqualsIgnoreEOL(String expected, String actual) throws IOException { + try (StringReader expectedReader = new StringReader(expected); + StringReader actualReader = new StringReader(actual); + ) { + if (!IOUtils.contentEqualsIgnoreEOL(expectedReader, actualReader)) { + throw new ComparisonFailure("", expected, actual); + } + } + } + + @Test + public void testBuildUsageText() throws IOException { + String string1 = PMDCommandLineInterface.buildUsageText(); + String string2 = PMDCommandLineInterface.buildUsageText(null); + Assert.assertEquals(string1, string2); + assertStringEqualsIgnoreEOL(TEST_BUILD_USAGE_TEXT_EXPECTED_1, string1); + String ta = "a"; + String tb = "c"; + Object tc = new Object(); + JCommander jcommander = new JCommander(); + jcommander.addCommand(ta, tc); + jcommander.addCommand(tb, tc); + String string3 = PMDCommandLineInterface.buildUsageText(jcommander); + assertStringEqualsIgnoreEOL(TEST_BUILD_USAGE_TEXT_EXPECTED_2, string3); + } + + static final String TEST_BUILD_USAGE_TEXT_EXPECTED_1 = "\n" + + "Mandatory arguments:\n" + + "1) A java source code filename or directory\n" + + "2) A report format \n" + + "3) A ruleset filename or a comma-delimited string of ruleset filenames\n" + + "\n" + + "For example: \n" + + "C:\\>pmd-bin-unknown\\bin\\pmd.bat -d c:\\my\\source\\code -f html -R java-unusedcode\n" + + "\n" + + "Languages and version suported:\n" + + "dummy, dummy2\n" + + "\n" + + "Available report formats and their configuration properties are:\n" + + " codeclimate: Code Climate integration.\n" + + " csv: Comma-separated values tabular format.\n" + + " problem - Include Problem column default: true\n" + + " package - Include Package column default: true\n" + + " file - Include File column default: true\n" + + " priority - Include Priority column default: true\n" + + " line - Include Line column default: true\n" + + " desc - Include Description column default: true\n" + + " ruleSet - Include Rule set column default: true\n" + + " rule - Include Rule column default: true\n" + + " emacs: GNU Emacs integration.\n" + + " empty: Empty, nothing.\n" + + " html: HTML format\n" + + " linePrefix - Prefix for line number anchor in the source file.\n" + + " linkPrefix - Path to HTML source.\n" + + " htmlExtension - Replace file extension with .html for the links (default: false) default: " + + "false\n" + + " ideaj: IntelliJ IDEA integration.\n" + + " classAndMethodName - Class and Method name, pass '.method' when processing a directory. " + + "default: \n" + + " sourcePath - Source path. default: \n" + + " fileName - File name. default: \n" + + " json: JSON format.\n" + + " summaryhtml: Summary HTML format.\n" + + " linePrefix - Prefix for line number anchor in the source file.\n" + + " linkPrefix - Path to HTML source.\n" + + " htmlExtension - Replace file extension with .html for the links (default: false) default: " + + "false\n" + + " text: Text format.\n" + + " textcolor: Text format, with color support (requires ANSI console support, e.g. xterm, rxvt, etc" + + ".).\n" + + " color - Enables colors with anything other than 'false' or '0'. default: yes\n" + + " textpad: TextPad integration.\n" + + " vbhtml: Vladimir Bossicard HTML format.\n" + + " xml: XML format.\n" + + " encoding - XML encoding format, defaults to UTF-8. default: UTF-8\n" + + " xslt: XML with a XSL Transformation applied.\n" + + " encoding - XML encoding format, defaults to UTF-8. default: UTF-8\n" + + " xsltFilename - The XSLT file name.\n" + + " yahtml: Yet Another HTML format.\n" + + " outputDir - Output directory.\n" + + "\n" + + "For example on windows: \n" + + "C:\\>pmd-bin-unknown\\bin\\pmd.bat -dir c:\\my\\source\\code -format text -R " + + "rulesets/java/quickstart.xml -version 1.5 -language java -debug\n" + + "C:\\>pmd-bin-unknown\\bin\\pmd.bat -dir c:\\my\\source\\code -f xml -rulesets " + + "rulesets/java/quickstart.xml,category/java/codestyle.xml -encoding UTF-8\n" + + "C:\\>pmd-bin-unknown\\bin\\pmd.bat -d c:\\my\\source\\code -rulesets rulesets/java/quickstart.xml " + + "-auxclasspath lib\\commons-collections.jar;lib\\derby.jar\n" + + "C:\\>pmd-bin-unknown\\bin\\pmd.bat -d c:\\my\\source\\code -f html -R rulesets/java/quickstart.xml " + + "-auxclasspath file:///C:/my/classpathfile\n" + + "\n" + + "For example on *nix: \n" + + "$ pmd-bin-unknown/bin/run.sh pmd -dir /home/workspace/src/main/java/code -f html -rulesets " + + "rulesets/java/quickstart.xml,category/java/codestyle.xml\n" + + "$ pmd-bin-unknown/bin/run.sh pmd -d ./src/main/java/code -R rulesets/java/quickstart.xml -f xslt " + + "-property xsltFilename=my-own.xsl\n" + + "$ pmd-bin-unknown/bin/run.sh pmd -d ./src/main/java/code -f html -R rulesets/java/quickstart.xml " + + "-auxclasspath commons-collections.jar:derby.jar\n" + + "\n" + + "\n" + + "\n"; + + static final String TEST_BUILD_USAGE_TEXT_EXPECTED_2 = "\n" + + "Mandatory arguments:\n" + + "1) A java source code filename or directory\n" + + "2) A report format \n" + + "3) A ruleset filename or a comma-delimited string of ruleset filenames\n" + + "\n" + + "For example: \n" + + "C:\\>pmd-bin-unknown\\bin\\pmd.bat -d c:\\my\\source\\code -f html -R java-unusedcode\n" + + "\n" + + "Languages and version suported:\n" + + "dummy, dummy2\n" + + "\n" + + "Optional arguments that may be put before or after the mandatory arguments: \n" + + "null\n" + + "null\n" + + "\n" + + "Available report formats and their configuration properties are:\n" + + " codeclimate: Code Climate integration.\n" + + " csv: Comma-separated values tabular format.\n" + + " problem - Include Problem column default: true\n" + + " package - Include Package column default: true\n" + + " file - Include File column default: true\n" + + " priority - Include Priority column default: true\n" + + " line - Include Line column default: true\n" + + " desc - Include Description column default: true\n" + + " ruleSet - Include Rule set column default: true\n" + + " rule - Include Rule column default: true\n" + + " emacs: GNU Emacs integration.\n" + + " empty: Empty, nothing.\n" + + " html: HTML format\n" + + " linePrefix - Prefix for line number anchor in the source file.\n" + + " linkPrefix - Path to HTML source.\n" + + " htmlExtension - Replace file extension with .html for the links (default: false) default: " + + "false\n" + + " ideaj: IntelliJ IDEA integration.\n" + + " classAndMethodName - Class and Method name, pass '.method' when processing a directory. " + + "default: \n" + + " sourcePath - Source path. default: \n" + + " fileName - File name. default: \n" + + " json: JSON format.\n" + + " summaryhtml: Summary HTML format.\n" + + " linePrefix - Prefix for line number anchor in the source file.\n" + + " linkPrefix - Path to HTML source.\n" + + " htmlExtension - Replace file extension with .html for the links (default: false) default: " + + "false\n" + + " text: Text format.\n" + + " textcolor: Text format, with color support (requires ANSI console support, e.g. xterm, rxvt, etc" + + ".).\n" + + " color - Enables colors with anything other than 'false' or '0'. default: yes\n" + + " textpad: TextPad integration.\n" + + " vbhtml: Vladimir Bossicard HTML format.\n" + + " xml: XML format.\n" + + " encoding - XML encoding format, defaults to UTF-8. default: UTF-8\n" + + " xslt: XML with a XSL Transformation applied.\n" + + " encoding - XML encoding format, defaults to UTF-8. default: UTF-8\n" + + " xsltFilename - The XSLT file name.\n" + + " yahtml: Yet Another HTML format.\n" + + " outputDir - Output directory.\n" + + "\n" + + "For example on windows: \n" + + "C:\\>pmd-bin-unknown\\bin\\pmd.bat -dir c:\\my\\source\\code -format text -R " + + "rulesets/java/quickstart.xml -version 1.5 -language java -debug\n" + + "C:\\>pmd-bin-unknown\\bin\\pmd.bat -dir c:\\my\\source\\code -f xml -rulesets " + + "rulesets/java/quickstart.xml,category/java/codestyle.xml -encoding UTF-8\n" + + "C:\\>pmd-bin-unknown\\bin\\pmd.bat -d c:\\my\\source\\code -rulesets rulesets/java/quickstart.xml " + + "-auxclasspath lib\\commons-collections.jar;lib\\derby.jar\n" + + "C:\\>pmd-bin-unknown\\bin\\pmd.bat -d c:\\my\\source\\code -f html -R rulesets/java/quickstart.xml " + + "-auxclasspath file:///C:/my/classpathfile\n" + + "\n" + + "For example on *nix: \n" + + "$ pmd-bin-unknown/bin/run.sh pmd -dir /home/workspace/src/main/java/code -f html -rulesets " + + "rulesets/java/quickstart.xml,category/java/codestyle.xml\n" + + "$ pmd-bin-unknown/bin/run.sh pmd -d ./src/main/java/code -R rulesets/java/quickstart.xml -f xslt " + + "-property xsltFilename=my-own.xsl\n" + + "$ pmd-bin-unknown/bin/run.sh pmd -d ./src/main/java/code -f html -R rulesets/java/quickstart.xml " + + "-auxclasspath commons-collections.jar:derby.jar\n" + + "\n" + + "\n" + + "\n"; } From 986b39208f5b98ae83fc214fcbec8a7598e9067d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Fri, 28 Aug 2020 13:59:13 +0200 Subject: [PATCH 3/5] Remove dead code in PMDCommandLineInterface --- .../pmd/cli/PMDCommandLineInterface.java | 28 +++++-------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/cli/PMDCommandLineInterface.java b/pmd-core/src/main/java/net/sourceforge/pmd/cli/PMDCommandLineInterface.java index 402b7726fd..04daf8b5dc 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/cli/PMDCommandLineInterface.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/cli/PMDCommandLineInterface.java @@ -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(); } From 292fa74ef5ed0ddf9124a217ca369c4afd62f555 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Fri, 28 Aug 2020 14:00:45 +0200 Subject: [PATCH 4/5] Simplify test I don't think we need to assert everything, the pmd-dist module already has a test like that --- .../pmd/cli/PMDCommandLineInterfaceTest.java | 187 +----------------- 1 file changed, 2 insertions(+), 185 deletions(-) diff --git a/pmd-core/src/test/java/net/sourceforge/pmd/cli/PMDCommandLineInterfaceTest.java b/pmd-core/src/test/java/net/sourceforge/pmd/cli/PMDCommandLineInterfaceTest.java index 87bf10342e..430c5503f9 100644 --- a/pmd-core/src/test/java/net/sourceforge/pmd/cli/PMDCommandLineInterfaceTest.java +++ b/pmd-core/src/test/java/net/sourceforge/pmd/cli/PMDCommandLineInterfaceTest.java @@ -6,15 +6,8 @@ package net.sourceforge.pmd.cli; import static org.junit.Assert.assertTrue; -import java.io.IOException; -import java.io.StringReader; - -import com.beust.jcommander.JCommander; - -import org.apache.commons.io.IOUtils; import org.junit.Assert; import org.junit.Before; -import org.junit.ComparisonFailure; import org.junit.Rule; import org.junit.Test; import org.junit.contrib.java.lang.system.ExpectedSystemExit; @@ -89,185 +82,9 @@ public class PMDCommandLineInterfaceTest { Assert.assertEquals(System.getProperty(PMDCommandLineInterface.STATUS_CODE_PROPERTY), "0"); } - static void assertStringEqualsIgnoreEOL(String expected, String actual) throws IOException { - try (StringReader expectedReader = new StringReader(expected); - StringReader actualReader = new StringReader(actual); - ) { - if (!IOUtils.contentEqualsIgnoreEOL(expectedReader, actualReader)) { - throw new ComparisonFailure("", expected, actual); - } - } - } - @Test - public void testBuildUsageText() throws IOException { - String string1 = PMDCommandLineInterface.buildUsageText(); - String string2 = PMDCommandLineInterface.buildUsageText(null); - Assert.assertEquals(string1, string2); - assertStringEqualsIgnoreEOL(TEST_BUILD_USAGE_TEXT_EXPECTED_1, string1); - String ta = "a"; - String tb = "c"; - Object tc = new Object(); - JCommander jcommander = new JCommander(); - jcommander.addCommand(ta, tc); - jcommander.addCommand(tb, tc); - String string3 = PMDCommandLineInterface.buildUsageText(jcommander); - assertStringEqualsIgnoreEOL(TEST_BUILD_USAGE_TEXT_EXPECTED_2, string3); + public void testBuildUsageText() { + Assert.assertNotNull(PMDCommandLineInterface.buildUsageText()); } - static final String TEST_BUILD_USAGE_TEXT_EXPECTED_1 = "\n" - + "Mandatory arguments:\n" - + "1) A java source code filename or directory\n" - + "2) A report format \n" - + "3) A ruleset filename or a comma-delimited string of ruleset filenames\n" - + "\n" - + "For example: \n" - + "C:\\>pmd-bin-unknown\\bin\\pmd.bat -d c:\\my\\source\\code -f html -R java-unusedcode\n" - + "\n" - + "Languages and version suported:\n" - + "dummy, dummy2\n" - + "\n" - + "Available report formats and their configuration properties are:\n" - + " codeclimate: Code Climate integration.\n" - + " csv: Comma-separated values tabular format.\n" - + " problem - Include Problem column default: true\n" - + " package - Include Package column default: true\n" - + " file - Include File column default: true\n" - + " priority - Include Priority column default: true\n" - + " line - Include Line column default: true\n" - + " desc - Include Description column default: true\n" - + " ruleSet - Include Rule set column default: true\n" - + " rule - Include Rule column default: true\n" - + " emacs: GNU Emacs integration.\n" - + " empty: Empty, nothing.\n" - + " html: HTML format\n" - + " linePrefix - Prefix for line number anchor in the source file.\n" - + " linkPrefix - Path to HTML source.\n" - + " htmlExtension - Replace file extension with .html for the links (default: false) default: " - + "false\n" - + " ideaj: IntelliJ IDEA integration.\n" - + " classAndMethodName - Class and Method name, pass '.method' when processing a directory. " - + "default: \n" - + " sourcePath - Source path. default: \n" - + " fileName - File name. default: \n" - + " json: JSON format.\n" - + " summaryhtml: Summary HTML format.\n" - + " linePrefix - Prefix for line number anchor in the source file.\n" - + " linkPrefix - Path to HTML source.\n" - + " htmlExtension - Replace file extension with .html for the links (default: false) default: " - + "false\n" - + " text: Text format.\n" - + " textcolor: Text format, with color support (requires ANSI console support, e.g. xterm, rxvt, etc" - + ".).\n" - + " color - Enables colors with anything other than 'false' or '0'. default: yes\n" - + " textpad: TextPad integration.\n" - + " vbhtml: Vladimir Bossicard HTML format.\n" - + " xml: XML format.\n" - + " encoding - XML encoding format, defaults to UTF-8. default: UTF-8\n" - + " xslt: XML with a XSL Transformation applied.\n" - + " encoding - XML encoding format, defaults to UTF-8. default: UTF-8\n" - + " xsltFilename - The XSLT file name.\n" - + " yahtml: Yet Another HTML format.\n" - + " outputDir - Output directory.\n" - + "\n" - + "For example on windows: \n" - + "C:\\>pmd-bin-unknown\\bin\\pmd.bat -dir c:\\my\\source\\code -format text -R " - + "rulesets/java/quickstart.xml -version 1.5 -language java -debug\n" - + "C:\\>pmd-bin-unknown\\bin\\pmd.bat -dir c:\\my\\source\\code -f xml -rulesets " - + "rulesets/java/quickstart.xml,category/java/codestyle.xml -encoding UTF-8\n" - + "C:\\>pmd-bin-unknown\\bin\\pmd.bat -d c:\\my\\source\\code -rulesets rulesets/java/quickstart.xml " - + "-auxclasspath lib\\commons-collections.jar;lib\\derby.jar\n" - + "C:\\>pmd-bin-unknown\\bin\\pmd.bat -d c:\\my\\source\\code -f html -R rulesets/java/quickstart.xml " - + "-auxclasspath file:///C:/my/classpathfile\n" - + "\n" - + "For example on *nix: \n" - + "$ pmd-bin-unknown/bin/run.sh pmd -dir /home/workspace/src/main/java/code -f html -rulesets " - + "rulesets/java/quickstart.xml,category/java/codestyle.xml\n" - + "$ pmd-bin-unknown/bin/run.sh pmd -d ./src/main/java/code -R rulesets/java/quickstart.xml -f xslt " - + "-property xsltFilename=my-own.xsl\n" - + "$ pmd-bin-unknown/bin/run.sh pmd -d ./src/main/java/code -f html -R rulesets/java/quickstart.xml " - + "-auxclasspath commons-collections.jar:derby.jar\n" - + "\n" - + "\n" - + "\n"; - - static final String TEST_BUILD_USAGE_TEXT_EXPECTED_2 = "\n" - + "Mandatory arguments:\n" - + "1) A java source code filename or directory\n" - + "2) A report format \n" - + "3) A ruleset filename or a comma-delimited string of ruleset filenames\n" - + "\n" - + "For example: \n" - + "C:\\>pmd-bin-unknown\\bin\\pmd.bat -d c:\\my\\source\\code -f html -R java-unusedcode\n" - + "\n" - + "Languages and version suported:\n" - + "dummy, dummy2\n" - + "\n" - + "Optional arguments that may be put before or after the mandatory arguments: \n" - + "null\n" - + "null\n" - + "\n" - + "Available report formats and their configuration properties are:\n" - + " codeclimate: Code Climate integration.\n" - + " csv: Comma-separated values tabular format.\n" - + " problem - Include Problem column default: true\n" - + " package - Include Package column default: true\n" - + " file - Include File column default: true\n" - + " priority - Include Priority column default: true\n" - + " line - Include Line column default: true\n" - + " desc - Include Description column default: true\n" - + " ruleSet - Include Rule set column default: true\n" - + " rule - Include Rule column default: true\n" - + " emacs: GNU Emacs integration.\n" - + " empty: Empty, nothing.\n" - + " html: HTML format\n" - + " linePrefix - Prefix for line number anchor in the source file.\n" - + " linkPrefix - Path to HTML source.\n" - + " htmlExtension - Replace file extension with .html for the links (default: false) default: " - + "false\n" - + " ideaj: IntelliJ IDEA integration.\n" - + " classAndMethodName - Class and Method name, pass '.method' when processing a directory. " - + "default: \n" - + " sourcePath - Source path. default: \n" - + " fileName - File name. default: \n" - + " json: JSON format.\n" - + " summaryhtml: Summary HTML format.\n" - + " linePrefix - Prefix for line number anchor in the source file.\n" - + " linkPrefix - Path to HTML source.\n" - + " htmlExtension - Replace file extension with .html for the links (default: false) default: " - + "false\n" - + " text: Text format.\n" - + " textcolor: Text format, with color support (requires ANSI console support, e.g. xterm, rxvt, etc" - + ".).\n" - + " color - Enables colors with anything other than 'false' or '0'. default: yes\n" - + " textpad: TextPad integration.\n" - + " vbhtml: Vladimir Bossicard HTML format.\n" - + " xml: XML format.\n" - + " encoding - XML encoding format, defaults to UTF-8. default: UTF-8\n" - + " xslt: XML with a XSL Transformation applied.\n" - + " encoding - XML encoding format, defaults to UTF-8. default: UTF-8\n" - + " xsltFilename - The XSLT file name.\n" - + " yahtml: Yet Another HTML format.\n" - + " outputDir - Output directory.\n" - + "\n" - + "For example on windows: \n" - + "C:\\>pmd-bin-unknown\\bin\\pmd.bat -dir c:\\my\\source\\code -format text -R " - + "rulesets/java/quickstart.xml -version 1.5 -language java -debug\n" - + "C:\\>pmd-bin-unknown\\bin\\pmd.bat -dir c:\\my\\source\\code -f xml -rulesets " - + "rulesets/java/quickstart.xml,category/java/codestyle.xml -encoding UTF-8\n" - + "C:\\>pmd-bin-unknown\\bin\\pmd.bat -d c:\\my\\source\\code -rulesets rulesets/java/quickstart.xml " - + "-auxclasspath lib\\commons-collections.jar;lib\\derby.jar\n" - + "C:\\>pmd-bin-unknown\\bin\\pmd.bat -d c:\\my\\source\\code -f html -R rulesets/java/quickstart.xml " - + "-auxclasspath file:///C:/my/classpathfile\n" - + "\n" - + "For example on *nix: \n" - + "$ pmd-bin-unknown/bin/run.sh pmd -dir /home/workspace/src/main/java/code -f html -rulesets " - + "rulesets/java/quickstart.xml,category/java/codestyle.xml\n" - + "$ pmd-bin-unknown/bin/run.sh pmd -d ./src/main/java/code -R rulesets/java/quickstart.xml -f xslt " - + "-property xsltFilename=my-own.xsl\n" - + "$ pmd-bin-unknown/bin/run.sh pmd -d ./src/main/java/code -f html -R rulesets/java/quickstart.xml " - + "-auxclasspath commons-collections.jar:derby.jar\n" - + "\n" - + "\n" - + "\n"; } From d82c9f141387b10a5a7d541540c90afabe1ccb91 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Mon, 31 Aug 2020 17:53:55 +0200 Subject: [PATCH 5/5] [doc] Update release notes, refs #2745 --- docs/pages/release_notes.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index cc0ca22491..5b6922300a 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -187,9 +187,10 @@ are deprecated as internal API. * [#2729](https://github.com/pmd/pmd/pull/2729): Cleanup: use print instead of printf if no format exists - [XenoAmess](https://github.com/XenoAmess) * [#2730](https://github.com/pmd/pmd/pull/2730): Cleanup: StringBuilder issues - [XenoAmess](https://github.com/XenoAmess) * [#2731](https://github.com/pmd/pmd/pull/2731): Cleanup: avoid compiling Patterns repeatedly - [XenoAmess](https://github.com/XenoAmess) -* [#2732](https://github.com/pmd/pmd/pull/2732): Cleanup: use StandardCharsets instead of Charset.forName - [XenoAmess](https://github.com/XenoAmess) -* [#2733](https://github.com/pmd/pmd/pull/2733): Cleanup: Collection::addAll issues - [XenoAmess](https://github.com/XenoAmess) +* [#2732](https://github.com/pmd/pmd/pull/2732): Cleanup: use StandardCharsets instead of Charset.forName - [XenoAmess](https://github.com/XenoAmess) +* [#2733](https://github.com/pmd/pmd/pull/2733): Cleanup: Collection::addAll issues - [XenoAmess](https://github.com/XenoAmess) * [#2734](https://github.com/pmd/pmd/pull/2734): Cleanup: use try with resources - [XenoAmess](https://github.com/XenoAmess) +* [#2745](https://github.com/pmd/pmd/pull/2745): \[core] Fix a NPE in buildUsageText - [XenoAmess](https://github.com/XenoAmess) {% endtocmaker %}