*** empty log message ***
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@1090 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
@ -1,22 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<project name="pmd-web" default="run-pmd">
|
||||
<target name="run-pmd">
|
||||
<taskdef name="pmd"
|
||||
classname="net.sourceforge.pmd.ant.PMDTask">
|
||||
<classpath>
|
||||
<pathelement location="${lib.repo}/pmd-0.3.jar" />
|
||||
</classpath>
|
||||
</taskdef>
|
||||
|
||||
<pmd reportFile="${project.name}/pmd.xml"
|
||||
verbose="false"
|
||||
rulesetfiles="rulesets/basic.xml"
|
||||
format="xml"
|
||||
failonerror="no">
|
||||
<fileset dir="${project.source}">
|
||||
<include name="**/*.java" />
|
||||
</fileset>
|
||||
</pmd>
|
||||
</target>
|
||||
</project>
|
@ -1,179 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<ruleset name="basic">
|
||||
<description>
|
||||
The Basic Ruleset contains a collection of good practice rules
|
||||
which everyone should follow.
|
||||
</description>
|
||||
|
||||
|
||||
<rule name="EmptyCatchBlock"
|
||||
message="Avoid empty catch blocks"
|
||||
class="net.sourceforge.pmd.rules.EmptyCatchBlockRule">
|
||||
<description>
|
||||
Empty Catch Block, will find instances where an exception is caught,
|
||||
but nothing is done. In most circumstances, this swallows an exception
|
||||
which should either be acted on or reported.
|
||||
</description>
|
||||
|
||||
<example>
|
||||
<![CDATA[
|
||||
public void doSomething() {
|
||||
try {
|
||||
FileInputStream fis = new FileInputStream("/tmp/bugger");
|
||||
} catch (IOException ioe) {
|
||||
// not good
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</example>
|
||||
</rule>
|
||||
|
||||
<rule name="EmptyIfStmt"
|
||||
message="Avoid empty 'if' statements"
|
||||
class="net.sourceforge.pmd.rules.EmptyIfStmtRule">
|
||||
<description>
|
||||
Empty If Statement, will find instances where a condition is checked,
|
||||
but nothing is done about it.
|
||||
</description>
|
||||
<example>
|
||||
<![CDATA[
|
||||
if (absValue < 1) {
|
||||
// not good
|
||||
}
|
||||
]]>
|
||||
</example>
|
||||
</rule>
|
||||
|
||||
<rule name="EmptyWhileStmt"
|
||||
message="Avoid empty 'while' statements"
|
||||
class="net.sourceforge.pmd.rules.EmptyWhileStmtRule">
|
||||
<description>
|
||||
Empty While Statement, will find all instances where a while statement
|
||||
does nothing. If it is a timing loop, then you should use Thread.sleep() for it; if
|
||||
it's a while loop that does a lot in the exit expression, rewrite it to make it clearer.
|
||||
</description>
|
||||
|
||||
<example>
|
||||
<![CDATA[
|
||||
while (a == b) {
|
||||
// not good
|
||||
}
|
||||
]]>
|
||||
</example>
|
||||
</rule>
|
||||
|
||||
<rule name="ShortVariable"
|
||||
message="Avoid variables with short names such as ''{0}''"
|
||||
class="net.sourceforge.pmd.rules.ShortVariableRule">
|
||||
<description>
|
||||
Short Variable: detects when a field, local or parameter has a
|
||||
length of less than 3 characters.
|
||||
</description>
|
||||
<example>
|
||||
<![CDATA[
|
||||
public class Something {
|
||||
private int q = 15; // VIOLATION - Field
|
||||
|
||||
public static void main( String as[] ) { // VIOLATION - Formal
|
||||
int r = 20 + q; // VIOLATION - Local
|
||||
|
||||
for (int i = 0; i < 10; i++) { // Not a Violation (inside FOR)
|
||||
r += q;
|
||||
}
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</example>
|
||||
</rule>
|
||||
|
||||
<rule name="LongVariable"
|
||||
message="Avoid excessively long variable names such as ''{0}''"
|
||||
class="net.sourceforge.pmd.rules.LongVariableRule">
|
||||
<description>
|
||||
Long Variable: detects when a field, formal or local variable is declared
|
||||
with a name larger than 12 characters.
|
||||
</description>
|
||||
<example>
|
||||
<![CDATA[
|
||||
public class Something {
|
||||
int reallyLongIntName = -3; // VIOLATION - Field
|
||||
|
||||
public static void main( String argumentsList[] ) { // VIOLATION - Formal
|
||||
int otherReallyLongName = -5; // VIOLATION - Local
|
||||
|
||||
for (int interestingIntIndex = 0; // VIOLATION - For
|
||||
interestingIntIndex < 10;
|
||||
interestingIntIndex ++ ) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
]]>
|
||||
</example>
|
||||
</rule>
|
||||
|
||||
<rule name="ShortMethodNameRule"
|
||||
message="Avoid using short method names such as ''{0}''"
|
||||
class="net.sourceforge.pmd.rules.ShortMethodNameRule">
|
||||
<description>
|
||||
Short Method Names: Detects when method names less than 4 characters
|
||||
long are used.
|
||||
</description>
|
||||
<example>
|
||||
<![CDATA[
|
||||
public class ShortMethod {
|
||||
public void a( int i ) { // Violation
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</example>
|
||||
</rule>
|
||||
|
||||
<rule name="IfElseStmtsMustUseBracesRule"
|
||||
message="Avoid using 'if...else' statements without curly braces"
|
||||
class="net.sourceforge.pmd.rules.IfElseStmtsMustUseBracesRule">
|
||||
<description>
|
||||
Avoid using if..else statements without using curly braces
|
||||
</description>
|
||||
|
||||
<example>
|
||||
<![CDATA[
|
||||
|
||||
public void doSomething() {
|
||||
// this is OK
|
||||
if (foo) x++;
|
||||
|
||||
// but this is not
|
||||
if (foo)
|
||||
x=x+1;
|
||||
else
|
||||
x=x-1;
|
||||
}
|
||||
]]>
|
||||
</example>
|
||||
</rule>
|
||||
|
||||
<rule name="UnnecessaryConversionTemporaryRule"
|
||||
message="Avoid unnecessary temporaries when converting primitives to Strings"
|
||||
class="net.sourceforge.pmd.rules.UnnecessaryConversionTemporaryRule">
|
||||
<description>
|
||||
Avoid unnecessary temporaries when converting primitives to Strings
|
||||
</description>
|
||||
|
||||
<example>
|
||||
<![CDATA[
|
||||
public String convert(int x) {
|
||||
// this wastes an object
|
||||
String foo = new Integer(x).toString();
|
||||
// this is better
|
||||
return Integer.toString(x);
|
||||
}
|
||||
]]>
|
||||
</example>
|
||||
</rule>
|
||||
|
||||
</ruleset>
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user