summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2012-10-18 14:10:13 (GMT)
committerKevin Smith <git@kismith.co.uk>2012-10-18 14:10:13 (GMT)
commitd14ab97b5d984afb3e18fb6a1afff7138e97f758 (patch)
treee79bb3bed755a3f40fb6f3cec0ae14a2fef1e3c3
parent595574d3fefb87741588371d37c2c35f3bb6a207 (diff)
downloadstroke-d14ab97b5d984afb3e18fb6a1afff7138e97f758.zip
stroke-d14ab97b5d984afb3e18fb6a1afff7138e97f758.tar.bz2
Use more PMD rules
Change-Id: I373469fa7a7ba8d5c639d4a1f2d4e07182eeb953
-rw-r--r--build.xml3
-rw-r--r--pmd-ruleset.xml67
2 files changed, 68 insertions, 2 deletions
diff --git a/build.xml b/build.xml
index e8c75e8..065cdef 100644
--- a/build.xml
+++ b/build.xml
@@ -144,8 +144,7 @@
</path>
<taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask" classpathref="pmd-jar"/>
<pmd shortFilenames="true">
- <ruleset>rulesets/java/basic.xml</ruleset>
- <ruleset>java-basic</ruleset>
+ <ruleset>pmd-ruleset.xml</ruleset>
<formatter type="xml" toFile="pmd.xml" />
<fileset dir="${src}">
<include name="**/*.java"/>
diff --git a/pmd-ruleset.xml b/pmd-ruleset.xml
new file mode 100644
index 0000000..5a84d16
--- /dev/null
+++ b/pmd-ruleset.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0"?>
+<ruleset name="Stroke rules" xmlns="http://pmd.sf.net/ruleset/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd" xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
+ <description>
+ Rules we don't hate too much.
+ </description>
+ <rule ref="rulesets/java/basic.xml">
+ <exclude name="CollapsibleIfStatements"/>
+ <exclude name="EmptyCatchBlock"/>
+ <!-- <exclude name="AvoidThreadGroup"/>-->
+ </rule>
+ <rule ref="rulesets/java/braces.xml"/>
+ <rule ref="rulesets/java/clone.xml">
+ <!--<exclude name="CloneThrowsCloneNotSupportedException"/>-->
+ </rule>
+ <rule ref="rulesets/java/controversial.xml">
+ <exclude name="DataflowAnomalyAnalysis"/>
+ <exclude name="AvoidFinalLocalVariable"/>
+ <exclude name="OnlyOneReturn"/>
+ <exclude name="NullAssignment"/>
+ <exclude name="AtLeastOneConstructor"/>
+ <exclude name="AssignmentInOperand"/>
+ <!--<exclude name="AvoidUsingNativeCode"/>-->
+ <exclude name="DefaultPackage"/>
+ <exclude name="AvoidLiteralsInIfCondition"/>
+ <exclude name="UseConcurrentHashMap"/> <!-- Disabling this, because we don't have concurrency -->
+ </rule>
+ <rule ref="rulesets/java/coupling.xml">
+ <!--<exclude name="ExcessiveImports"/>-->
+ <exclude name="CouplingBetweenObjects"/>
+ </rule>
+ <rule ref="rulesets/java/design.xml">
+ <exclude name="SwitchStmtsShouldHaveDefault"/>
+ <exclude name="UncommentedEmptyMethod"/>
+ <exclude name="UncommentedEmptyConstructor"/>
+ <exclude name="EmptyMethodInAbstractClassShouldBeAbstract"/>
+ <exclude name="AvoidDeeplyNestedIfStmts"/>
+ <exclude name="ConfusingTernary"/>
+ <exclude name="PreserveStackTrace"/>
+ </rule>
+ <rule ref="rulesets/java/finalizers.xml"/>
+ <rule ref="rulesets/java/imports.xml"/>
+ <rule ref="rulesets/java/migrating.xml"/>
+ <rule ref="rulesets/java/naming.xml">
+ <exclude name="ShortVariable"/>
+ <exclude name="ShortMethodName"/>
+ <exclude name="LongVariable"/>
+ <exclude name="AvoidFieldNameMatchingTypeName"/>
+ <exclude name="AbstractNaming"/>
+ <!-- Excluded for the Tcl stuff -->
+ <exclude name="MethodNamingConventions"/>
+ </rule>
+ <rule ref="rulesets/java/optimizations.xml">
+ <!--<exclude name="LocalVariableCouldBeFinal"/>-->
+ <!--<exclude name="MethodArgumentCouldBeFinal"/>-->
+ <exclude name="AvoidInstantiatingObjectsInLoops"/>
+ <exclude name="UseStringBufferForStringAppends"/>
+ </rule>
+ <rule ref="rulesets/java/strictexception.xml">
+ <!--<exclude name="SignatureDeclareThrowsException"/>-->
+ <!--<exclude name="ExceptionAsFlowControl"/>-->
+ </rule>
+ <rule ref="rulesets/java/strings.xml">
+ <!--<exclude name="AvoidDuplicateLiterals"/>-->
+ <!--<exclude name="InsufficientStringBufferDeclaration"/>-->
+ </rule>
+ <rule ref="rulesets/java/unusedcode.xml"/>
+</ruleset>