Skip to content

Commit 73a92fe

Browse files
authored
Added some additional checkstyle/pmd checks (#406)
Checkstyle: - Change NewlineAtEndOfFile (error): Changed no new line at end of file to error (we always keep commenting on it. So if it's an error people have to fix it right away). - EqualsAvoidNull (warning): Give warning when constant not at the left side of equals. PMD: - Added CompareObjectsWithEquals (error): Use equals to compare objects. - UseCollectionIsEmpty (warning): Use isEmpty() to check if collection is empty. - SimplifyBooleanReturns (info) - UnusedLocalVariable (info) - UnusedPrivateField (info) - UnusedPrivateMethod (info) Signed-off-by: Hilbrand Bouwkamp <hilbrand@h72.nl>
1 parent e05974e commit 73a92fe

2 files changed

Lines changed: 23 additions & 1 deletion

File tree

sat-plugin/src/main/resources/rulesets/checkstyle/rules.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
</module>
4444

4545
<module name="NewlineAtEndOfFile">
46-
<property name="severity" value="info"/>
46+
<property name="severity" value="error"/>
4747
</module>
4848

4949
<module name="org.openhab.tools.analysis.checkstyle.ExportInternalPackageCheck">
@@ -288,5 +288,8 @@
288288
<module name="MemberName">
289289
<property name="severity" value="info"/>
290290
</module>
291+
<module name="EqualsAvoidNull">
292+
<property name="severity" value="warning"/>
293+
</module>
291294
</module>
292295
</module>

sat-plugin/src/main/resources/rulesets/pmd/rules.xml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@
5555
<rule ref="category/java/errorprone.xml/DoNotThrowExceptionInFinally">
5656
<priority>2</priority>
5757
</rule>
58+
<rule ref="category/java/errorprone.xml/CompareObjectsWithEquals">
59+
<priority>1</priority>
60+
</rule>
5861
<rule ref="category/java/errorprone.xml/EqualsNull">
5962
<priority>1</priority>
6063
</rule>
@@ -67,6 +70,9 @@
6770
<rule ref="category/java/errorprone.xml/CompareObjectsWithEquals">
6871
<priority>3</priority>
6972
</rule>
73+
<rule ref="category/java/bestpractices.xml/UseCollectionIsEmpty">
74+
<priority>2</priority>
75+
</rule>
7076

7177
<!-- See https://pmd.github.io/pmd-6.7.0/pmd_rules_java_multithreading.html -->
7278
<rule ref="category/java/multithreading.xml/DontCallThreadRun">
@@ -78,6 +84,16 @@
7884
<rule ref="category/java/multithreading.xml/UnsynchronizedStaticFormatter">
7985
<priority>3</priority>
8086
</rule>
87+
<rule ref="category/java/bestpractices.xml/UnusedLocalVariable">
88+
<priority>3</priority>
89+
</rule>
90+
<rule ref="category/java/bestpractices.xml/UnusedPrivateField">
91+
<priority>3</priority>
92+
</rule>
93+
<rule ref="category/java/bestpractices.xml/UnusedPrivateMethod">
94+
<priority>3</priority>
95+
</rule>
96+
8197

8298
<!-- See https://pmd.github.io/pmd-6.7.0/pmd_rules_java_bestpractices.html -->
8399
<rule ref="category/java/bestpractices.xml/AvoidPrintStackTrace">
@@ -100,6 +116,9 @@
100116
<rule ref="category/java/design.xml/SimplifyBooleanExpressions">
101117
<priority>3</priority>
102118
</rule>
119+
<rule ref="category/java/design.xml/SimplifyBooleanReturns">
120+
<priority>3</priority>
121+
</rule>
103122

104123
<!-- See https://pmd.github.io/pmd-6.7.0/pmd_rules_java_performance.html -->
105124
<rule ref="category/java/performance.xml/AvoidArrayLoops">

0 commit comments

Comments
 (0)