Browse Source

Minor tidying.

Disable some new 'controversial' PMD rules, and enable some of the
others we had suppressed.

Change-Id: Ia15d78858617e8b4dcc71c47b91d9975118206a9
Reviewed-on: http://gerrit.dmdirc.com/3642
Automatic-Compile: DMDirc Build Manager
Reviewed-by: Greg Holmes <greg@dmdirc.com>
pull/1/head
Chris Smith 9 years ago
parent
commit
db706b6de8

+ 5
- 8
etc/pmd/minimal.xml View File

5
 	 xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
5
 	 xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
6
 	 xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
6
 	 xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
7
 	<description>DMDirc minimal PMD checks.</description>
7
 	<description>DMDirc minimal PMD checks.</description>
8
-	
9
-	<rule ref="rulesets/basic.xml">
10
-		<exclude name="EmptyCatchBlock"/> <!-- ! -->
11
-	</rule>
8
+
9
+	<rule ref="rulesets/basic.xml"/>
12
 	<rule ref="rulesets/braces.xml"/>
10
 	<rule ref="rulesets/braces.xml"/>
13
 	<rule ref="rulesets/clone.xml"/>
11
 	<rule ref="rulesets/clone.xml"/>
14
 	<rule ref="rulesets/controversial.xml">
12
 	<rule ref="rulesets/controversial.xml">
19
 		<exclude name="AvoidFinalLocalVariable"/>
17
 		<exclude name="AvoidFinalLocalVariable"/>
20
 		<exclude name="AssignmentInOperand"/>
18
 		<exclude name="AssignmentInOperand"/>
21
 		<exclude name="CallSuperInConstructor"/>
19
 		<exclude name="CallSuperInConstructor"/>
22
-		<exclude name="DefaultPackage"/> <!-- ! -->
23
 		<exclude name="AvoidUsingVolatile"/>
20
 		<exclude name="AvoidUsingVolatile"/>
24
 		<exclude name="BooleanInversion"/>
21
 		<exclude name="BooleanInversion"/>
22
+		<exclude name="AtLeastOneConstructor"/>
23
+                <exclude name="AvoidLiteralsInIfCondition"/>
25
 		<exclude name="AvoidUsingNativeCode"/>
24
 		<exclude name="AvoidUsingNativeCode"/>
26
 		<exclude name="AvoidUsingShortType"/>
25
 		<exclude name="AvoidUsingShortType"/>
27
 	</rule>
26
 	</rule>
32
 		<exclude name="SwitchStmtsShouldHaveDefault"/>
31
 		<exclude name="SwitchStmtsShouldHaveDefault"/>
33
 		<exclude name="UseLocaleWithCaseConversions"/>
32
 		<exclude name="UseLocaleWithCaseConversions"/>
34
 		<exclude name="AvoidSynchronizedAtMethodLevel"/> <!-- ! -->
33
 		<exclude name="AvoidSynchronizedAtMethodLevel"/> <!-- ! -->
35
-		<exclude name="ImmutableField"/> <!-- ! -->
36
 		<exclude name="SimpleDateFormatNeedsLocale"/>
34
 		<exclude name="SimpleDateFormatNeedsLocale"/>
37
 		<exclude name="EmptyMethodInAbstractClassShouldBeAbstract"/>
35
 		<exclude name="EmptyMethodInAbstractClassShouldBeAbstract"/>
38
 		<exclude name="PositionLiteralsFirstInComparisons"/>
36
 		<exclude name="PositionLiteralsFirstInComparisons"/>
37
+		<exclude name="UncommentedEmptyMethod"/>
39
 	</rule>
38
 	</rule>
40
 	<rule ref="rulesets/finalizers.xml"/>
39
 	<rule ref="rulesets/finalizers.xml"/>
41
 	<rule ref="rulesets/imports.xml"/>
40
 	<rule ref="rulesets/imports.xml"/>
58
 	<rule ref="rulesets/optimizations.xml">
57
 	<rule ref="rulesets/optimizations.xml">
59
                 <exclude name="AvoidInstantiatingObjectsInLoops"/>
58
                 <exclude name="AvoidInstantiatingObjectsInLoops"/>
60
 		<exclude name="UseStringBufferForStringAppends"/>
59
 		<exclude name="UseStringBufferForStringAppends"/>
61
-		<exclude name="LocalVariableCouldBeFinal"/> <!-- ! -->
62
-		<exclude name="MethodArgumentCouldBeFinal"/> <!-- ! -->
63
 		<exclude name="AddEmptyString"/>
60
 		<exclude name="AddEmptyString"/>
64
         </rule>
61
         </rule>
65
 	<rule ref="rulesets/strings.xml">
62
 	<rule ref="rulesets/strings.xml">

+ 3
- 3
src/com/dmdirc/logger/ProgramError.java View File

65
     /** Date/time error last occurred. */
65
     /** Date/time error last occurred. */
66
     private Date lastDate;
66
     private Date lastDate;
67
     /** Number of occurrences. */
67
     /** Number of occurrences. */
68
-    private AtomicInteger count;
68
+    private final AtomicInteger count;
69
     /** Error report Status. */
69
     /** Error report Status. */
70
     private ErrorReportStatus reportStatus;
70
     private ErrorReportStatus reportStatus;
71
 
71
 
136
      * @return Error trace
136
      * @return Error trace
137
      */
137
      */
138
     public String[] getTrace() {
138
     public String[] getTrace() {
139
-        return exception != null ? getTrace(exception) : message != null ? new String[]{message}
140
-                : new String[0];
139
+        return exception == null ? (message == null ? new String[0] : new String[]{message})
140
+                : getTrace(exception);
141
     }
141
     }
142
 
142
 
143
     /**
143
     /**

+ 1
- 1
src/com/dmdirc/ui/CoreUIUtils.java View File

32
 /**
32
 /**
33
  * Core UI Utilities.
33
  * Core UI Utilities.
34
  */
34
  */
35
-public class CoreUIUtils {
35
+public final class CoreUIUtils {
36
 
36
 
37
     /** Precent creation. */
37
     /** Precent creation. */
38
     private CoreUIUtils() {
38
     private CoreUIUtils() {

+ 1
- 1
src/com/dmdirc/ui/core/util/Utils.java View File

43
 /**
43
 /**
44
  * Core UI Utilities.
44
  * Core UI Utilities.
45
  */
45
  */
46
-public class Utils {
46
+public final class Utils {
47
 
47
 
48
     /** Prevent instantiation. */
48
     /** Prevent instantiation. */
49
     private Utils() {
49
     private Utils() {

+ 1
- 1
src/com/dmdirc/util/YamlReaderUtils.java View File

33
 /**
33
 /**
34
  * Provides utility methods for classes that read from YAML files.
34
  * Provides utility methods for classes that read from YAML files.
35
  */
35
  */
36
-public class YamlReaderUtils {
36
+public final class YamlReaderUtils {
37
 
37
 
38
     private YamlReaderUtils() {
38
     private YamlReaderUtils() {
39
         // Shouldn't be instansiated
39
         // Shouldn't be instansiated

+ 1
- 1
src/com/dmdirc/util/resourcemanager/DMDircResourceManager.java View File

38
 /**
38
 /**
39
  * Provides utility methods for working with resources from the DMDirc distribution.
39
  * Provides utility methods for working with resources from the DMDirc distribution.
40
  */
40
  */
41
-public class DMDircResourceManager {
41
+public final class DMDircResourceManager {
42
 
42
 
43
     private DMDircResourceManager() {
43
     private DMDircResourceManager() {
44
         //Prevent instantiation
44
         //Prevent instantiation

Loading…
Cancel
Save