forked from phoedos/pmd
Implemented RFE 1566313 - allow minimumpriority attribute to be set at command line
used same attribute as the ant task, minimumpriority, but used all lower case to keep in line with other command line params git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@4682 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
@ -12,6 +12,7 @@ Fixed bug 1566547 - Annotations with an empty MemberValueArrayInitializer are no
|
||||
Applied patch 1551189 - SingularField false + for initialization blocks
|
||||
Applied patch 1573981 - false + in CloneMethodMustImplementCloneable
|
||||
Applied patch 1574988 - false + in OverrideBothEqualsAndHashcode
|
||||
Implemented RFE 1566313 - Command Line now takes minimumpriority attribute to filter out rulesets
|
||||
PMD now requires JDK 1.4 to run. Note that, however, PMD will still analyze code from earlier JDKs.
|
||||
SummaryHTML Report changes from Brent Fisher - now contains linePrefix to support source output from javadoc using "linksource"
|
||||
Fixed CSVRenderer - had flipped line and priority columns
|
||||
|
@ -16,6 +16,7 @@ import net.sourceforge.pmd.renderers.XMLRenderer;
|
||||
import net.sourceforge.pmd.renderers.YAHTMLRenderer;
|
||||
|
||||
import java.io.InputStreamReader;
|
||||
import java.text.MessageFormat;
|
||||
|
||||
public class CommandLineOptions {
|
||||
|
||||
@ -30,6 +31,8 @@ public class CommandLineOptions {
|
||||
private String encoding = new InputStreamReader(System.in).getEncoding();
|
||||
private String linePrefix;
|
||||
private String linkPrefix;
|
||||
private int minPriority = Rule.LOWEST_PRIORITY;
|
||||
|
||||
|
||||
private boolean checkJavaFiles = true;
|
||||
private boolean checkJspFiles = false;
|
||||
@ -67,6 +70,14 @@ public class CommandLineOptions {
|
||||
linePrefix = args[i + 1];
|
||||
} else if (args[i].equals("-linkprefix")) {
|
||||
linkPrefix = args[i + 1];
|
||||
} else if (args[i].equals("-minimumpriority")) {
|
||||
try {
|
||||
minPriority = Integer.parseInt(args[i + 1]);
|
||||
} catch (NumberFormatException e) {
|
||||
throw new RuntimeException(MessageFormat.format(
|
||||
"minimumpriority parameter must be a whole number, {0} recieved",
|
||||
new String[] { args[i + 1] }));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -141,6 +152,10 @@ public class CommandLineOptions {
|
||||
return shortNamesEnabled;
|
||||
}
|
||||
|
||||
public int getMinPriority() {
|
||||
return minPriority;
|
||||
}
|
||||
|
||||
public String usage() {
|
||||
return PMD.EOL + PMD.EOL +
|
||||
"Mandatory arguments:" + PMD.EOL +
|
||||
@ -159,6 +174,7 @@ public class CommandLineOptions {
|
||||
"-shortnames: prints shortened filenames in the report" + PMD.EOL +
|
||||
"-linkprefix: path to HTML source, for summary html renderer only." + PMD.EOL +
|
||||
"-lineprefix: custom anchor to affected line in the source file, for summary html renderer only." + PMD.EOL +
|
||||
"-minimumpriority: The rule priority threshold; rules with lower priority than they will not be used." + PMD.EOL +
|
||||
PMD.EOL +
|
||||
"For example: " + PMD.EOL +
|
||||
"c:\\> java -jar pmd-" + PMD.VERSION + ".jar c:\\my\\source\\code text unusedcode,imports -targetjdk 1.5 -debug" + PMD.EOL +
|
||||
|
@ -247,6 +247,7 @@ public class PMD {
|
||||
|
||||
try {
|
||||
RuleSetFactory ruleSetFactory = new RuleSetFactory();
|
||||
ruleSetFactory.setMinimumPriority(opts.getMinPriority());
|
||||
RuleSets rulesets = ruleSetFactory.createRuleSets(opts.getRulesets());
|
||||
printRuleNamesInDebug(opts.debugEnabled(), rulesets);
|
||||
|
||||
@ -336,7 +337,7 @@ public class PMD {
|
||||
* @param inputFileName a file name
|
||||
* @param fileSelector Filtering of wanted source files
|
||||
* @return the list of files collected from the <code>inputFileName</code>
|
||||
* @see #collect(String)
|
||||
* @see #collect(String, SourceFileSelector)
|
||||
*/
|
||||
private static List collectFilesFromOneName(String inputFileName,
|
||||
SourceFileSelector fileSelector) {
|
||||
|
@ -96,7 +96,7 @@
|
||||
<li>Bhatia Saurabh - Reported a grammar bug, reported a bug in UseStringBufferLength</li>
|
||||
<li>Chris Erskine - found bad link, documentation suggestions</li>
|
||||
<li>mhilpert - Reported bugs in UseIndexOfChar and LoggerIsNotStaticFinal</li>
|
||||
<li>David Corley - Priority filtering XSLT, reported release packaging problem, implemented nifty Javascript folding for XML report, <a href="http://tomcopeland.blogs.com/juniordeveloper/2005/12/demo_of_some_ni.html">demo is here</a></li>
|
||||
<li>David Corley - Priority filtering XSLT, reported release packaging problem, implemented nifty Javascript folding for XML report, <a href="http://tomcopeland.blogs.com/juniordeveloper/2005/12/demo_of_some_ni.html">demo is here</a>, suggestion for min priority on the command line</li>
|
||||
<li>Jon Doh - Reported parser bug</li>
|
||||
<li>Brian R - suggestions for improving UseIndexOfChar, documentation suggestion</li>
|
||||
<li>Didier Duquennoy - bug reports for InefficientStringBuffering/ConsecutiveLiteralAppends/AppendCharacterWithChar, several bug reports for InefficientStringBuffering, bug report for ImmutableField, suggestions for improving Benchmark utility, bug report for InefficientStringBuffering, bug report for AvoidConcateningNonLiteralsInStringBuffer, reported a missed hit for EqualsNull, bug report for MissingStaticMethodInNonInstantiatableClass, pmd-netbeans feedback</li>
|
||||
|
@ -50,6 +50,9 @@ java net.sourceforge.pmd.PMD /path/to/source text basic,imports,unusedcode
|
||||
<li><code>-targetjdk [1.3|1.4|1.5]</code> - selects either JDK 1.3, 1.4 or 1.5 language compatibility; default is 1.4</li>
|
||||
<li><code>-encoding Cp1252</code> - uses the specified encoding for reading the source code files</li>
|
||||
<li><code>-excludemarker NOPMDFORME</code> - uses the specified string of characters as the marker for PMD to ignore. The default string is "NOPMD".</li>
|
||||
<li><code>-linkprefix</code> - path to HTML source, for summary html renderer only.</li>
|
||||
<li><code>-lineprefix</code> - custom anchor to affected line in the source file, for summary html renderer only.</li>
|
||||
<li><code>-minimumpriority</code> - The rule priority threshold; rules with lower priority than they will not be used.</li>
|
||||
</ul>
|
||||
</ul>
|
||||
</section>
|
||||
|
Reference in New Issue
Block a user