Minor cleanup

This commit is contained in:
Erik C. Thauvin 2023-04-14 18:40:39 -07:00
parent 13a6a75613
commit c42d164dd3
9 changed files with 44 additions and 37 deletions

View file

@ -177,7 +177,7 @@ class PmdOperationTest {
void testJavaSecurity() { void testJavaSecurity() {
var pmd = newPmdOperation().ruleSets("category/java/security.xml") var pmd = newPmdOperation().ruleSets("category/java/security.xml")
.inputPaths(Path.of("src/test/resources/java/Security.java")); .inputPaths(Path.of("src/test/resources/java/Security.java"));
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isEqualTo(0); assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isEqualTo(1);
} }
@Test @Test

View file

@ -14,7 +14,9 @@
* limitations under the License. * limitations under the License.
*/ */
package java;/** package java;
/**
* BestPractices class * BestPractices class
* *
* @author <a href="https://erik.thauvin.net/">Erik C. Thauvin</a> * @author <a href="https://erik.thauvin.net/">Erik C. Thauvin</a>

View file

@ -14,7 +14,9 @@
* limitations under the License. * limitations under the License.
*/ */
package java;/** package java;
/**
* Design class * Design class
* *
* @author <a href="https://erik.thauvin.net/">Erik C. Thauvin</a> * @author <a href="https://erik.thauvin.net/">Erik C. Thauvin</a>

View file

@ -14,7 +14,9 @@
* limitations under the License. * limitations under the License.
*/ */
package java;/** package java;
/**
* @author <a href="https://erik.thauvin.net/">Erik C. Thauvin</a> * @author <a href="https://erik.thauvin.net/">Erik C. Thauvin</a>
* @since 1.0 * @since 1.0
*/ */

View file

@ -14,7 +14,9 @@
* limitations under the License. * limitations under the License.
*/ */
package java;/** package java;
/**
* ErrorProne class * ErrorProne class
* *
* @author <a href="https://erik.thauvin.net/">Erik C. Thauvin</a> * @author <a href="https://erik.thauvin.net/">Erik C. Thauvin</a>

View file

@ -14,7 +14,9 @@
* limitations under the License. * limitations under the License.
*/ */
package java;import java.text.SimpleDateFormat; package java;
import java.text.SimpleDateFormat;
/** /**
* MultiThreading class * MultiThreading class

View file

@ -14,7 +14,9 @@
* limitations under the License. * limitations under the License.
*/ */
package java;/** package java;
/**
* Performance class * Performance class
* *
* @author <a href="https://erik.thauvin.net/">Erik C. Thauvin</a> * @author <a href="https://erik.thauvin.net/">Erik C. Thauvin</a>

View file

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package java;import java.security.SecureRandom; package java;
/** /**
* Security class * Security class
@ -24,11 +24,6 @@ package java;import java.security.SecureRandom;
*/ */
public class Security { public class Security {
void bad() { void bad() {
byte[] iv = new byte[] { 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, }; SecretKeySpec secretKeySpec = new SecretKeySpec("my secret here".getBytes(), "AES");
} }
void alsoBad() {
byte[] iv = "secret iv in here".getBytes();
}
} }

View file

@ -9,34 +9,34 @@
</description> </description>
<!-- Rules, that have been moved into a category --> <!-- Rules, that have been moved into a category -->
<rule ref="category/java/errorprone.xml/AvoidBranchingStatementAsLastInLoop" deprecated="true" /> <rule ref="category/java/errorprone.xml/AvoidBranchingStatementAsLastInLoop" deprecated="true"/>
<rule ref="category/java/errorprone.xml/AvoidDecimalLiteralsInBigDecimalConstructor" deprecated="true" /> <rule ref="category/java/errorprone.xml/AvoidDecimalLiteralsInBigDecimalConstructor" deprecated="true"/>
<rule ref="category/java/errorprone.xml/AvoidMultipleUnaryOperators" deprecated="true" /> <rule ref="category/java/errorprone.xml/AvoidMultipleUnaryOperators" deprecated="true"/>
<rule ref="category/java/errorprone.xml/AvoidUsingOctalValues" deprecated="true" /> <rule ref="category/java/errorprone.xml/AvoidUsingOctalValues" deprecated="true"/>
<rule ref="category/java/errorprone.xml/BrokenNullCheck" deprecated="true" /> <rule ref="category/java/errorprone.xml/BrokenNullCheck" deprecated="true"/>
<rule ref="category/java/errorprone.xml/CheckSkipResult" deprecated="true" /> <rule ref="category/java/errorprone.xml/CheckSkipResult" deprecated="true"/>
<rule ref="category/java/errorprone.xml/ClassCastExceptionWithToArray" deprecated="true" /> <rule ref="category/java/errorprone.xml/ClassCastExceptionWithToArray" deprecated="true"/>
<rule ref="category/java/errorprone.xml/DontUseFloatTypeForLoopIndices" deprecated="true" /> <rule ref="category/java/errorprone.xml/DontUseFloatTypeForLoopIndices" deprecated="true"/>
<rule ref="category/java/errorprone.xml/JumbledIncrementer" deprecated="true" /> <rule ref="category/java/errorprone.xml/JumbledIncrementer" deprecated="true"/>
<rule ref="category/java/errorprone.xml/MisplacedNullCheck" deprecated="true" /> <rule ref="category/java/errorprone.xml/MisplacedNullCheck" deprecated="true"/>
<rule ref="category/java/errorprone.xml/OverrideBothEqualsAndHashcode" deprecated="true" /> <rule ref="category/java/errorprone.xml/OverrideBothEqualsAndHashcode" deprecated="true"/>
<rule ref="category/java/errorprone.xml/ReturnFromFinallyBlock" deprecated="true" /> <rule ref="category/java/errorprone.xml/ReturnFromFinallyBlock" deprecated="true"/>
<rule ref="category/java/errorprone.xml/UnconditionalIfStatement" deprecated="true" /> <rule ref="category/java/errorprone.xml/UnconditionalIfStatement" deprecated="true"/>
<rule ref="category/java/multithreading.xml/AvoidThreadGroup" deprecated="true" /> <rule ref="category/java/multithreading.xml/AvoidThreadGroup" deprecated="true"/>
<rule ref="category/java/multithreading.xml/DontCallThreadRun" deprecated="true" /> <rule ref="category/java/multithreading.xml/DontCallThreadRun" deprecated="true"/>
<rule ref="category/java/multithreading.xml/DoubleCheckedLocking" deprecated="true" /> <rule ref="category/java/multithreading.xml/DoubleCheckedLocking" deprecated="true"/>
<rule ref="category/java/bestpractices.xml/AvoidUsingHardCodedIP" deprecated="true" /> <rule ref="category/java/bestpractices.xml/AvoidUsingHardCodedIP" deprecated="true"/>
<rule ref="category/java/bestpractices.xml/CheckResultSet" deprecated="true" /> <rule ref="category/java/bestpractices.xml/CheckResultSet" deprecated="true"/>
<rule ref="category/java/codestyle.xml/ExtendsObject" deprecated="true" /> <rule ref="category/java/codestyle.xml/ExtendsObject" deprecated="true"/>
<rule ref="category/java/codestyle.xml/ForLoopShouldBeWhileLoop" deprecated="true" /> <rule ref="category/java/codestyle.xml/ForLoopShouldBeWhileLoop" deprecated="true"/>
<rule ref="category/java/performance.xml/BigIntegerInstantiation" deprecated="true" /> <rule ref="category/java/performance.xml/BigIntegerInstantiation" deprecated="true"/>
<!-- <rule ref="category/java/performance.xml/BooleanInstantiation" deprecated="true" />--> <!-- <rule ref="category/java/performance.xml/BooleanInstantiation" deprecated="true" />-->
<rule ref="category/java/design.xml/CollapsibleIfStatements" deprecated="true" /> <rule ref="category/java/design.xml/CollapsibleIfStatements" deprecated="true"/>
<rule ref="category/java/design.xml/SimplifiedTernary" deprecated="true" /> <rule ref="category/java/design.xml/SimplifiedTernary" deprecated="true"/>
</ruleset> </ruleset>