Skip to content

Commit

Permalink
[ci] Fixes PMD warnings (#2764)
Browse files Browse the repository at this point in the history
  • Loading branch information
frankfliu authored Aug 23, 2023
1 parent 59af05f commit aa74157
Show file tree
Hide file tree
Showing 11 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion api/src/main/java/ai/djl/training/Trainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ public List<Evaluator> getEvaluators() {
*
* @param listenerConsumer a consumer that executes the method
*/
public void notifyListeners(Consumer<TrainingListener> listenerConsumer) {
public final void notifyListeners(Consumer<TrainingListener> listenerConsumer) {
listeners.forEach(listenerConsumer);
}

Expand Down
1 change: 1 addition & 0 deletions api/src/test/java/ai/djl/nn/BlockFactoryTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.nio.file.Path;
import java.nio.file.Paths;

@SuppressWarnings("PMD.TestClassWithoutTestCases")
public class BlockFactoryTest {

@Test
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
import java.util.jar.JarFile;
import java.util.stream.Collectors;

@SuppressWarnings("PMD.TestClassWithoutTestCases")
public class IntegrationTest {

private static final Logger logger = LoggerFactory.getLogger(IntegrationTest.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import java.util.List;
import java.util.stream.Stream;

@SuppressWarnings("PMD.TestClassWithoutTestCases")
public class StreamingTest {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ private Path prepareModel(Path savedDir) throws IOException, ModelException {
return zipPath;
}

@SuppressWarnings("PMD.TestClassWithoutTestCases")
public static class TestBlockFactory implements BlockFactory {

private static final long serialVersionUID = 1234567L;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.testng.Assert;
import org.testng.annotations.Test;

@SuppressWarnings("PMD.TestClassWithoutTestCases")
public class ScaledDotProductAttentionBlockTest {

private double[] keySequenceInitialization = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import java.util.Arrays;

@SuppressWarnings("PMD.TestClassWithoutTestCases")
public final class TestUtils {

private static String engineName = Engine.getDefaultEngineName();
Expand Down
2 changes: 1 addition & 1 deletion testing/src/main/java/ai/djl/testing/CoverageUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
import java.util.jar.JarFile;
import java.util.stream.Collectors;

@SuppressWarnings("PMD.AvoidAccessibilityAlteration")
@SuppressWarnings({"PMD.AvoidAccessibilityAlteration", "PMD.TestClassWithoutTestCases"})
public final class CoverageUtils {

private CoverageUtils() {}
Expand Down
1 change: 1 addition & 0 deletions testing/src/main/java/ai/djl/testing/TestRequirements.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
* <p>When the test requirements are not fulfilled, the test is skipped with a {@link
* SkipException}.
*/
@SuppressWarnings("PMD.TestClassWithoutTestCases")
public final class TestRequirements {

private TestRequirements() {}
Expand Down
1 change: 0 additions & 1 deletion tools/conf/pmd.xml
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,6 @@
<exclude name="AvoidFieldNameMatchingTypeName"/>
<exclude name="AvoidInstanceofChecksInCatchClause"/>
<exclude name="AvoidLiteralsInIfCondition"/>
<exclude name="BeanMembersShouldSerialize"/>
<exclude name="CloneMethodMustImplementCloneable"/>
<exclude name="CloseResource"/>
<exclude name="CompareObjectsWithEquals"/>
Expand Down

0 comments on commit aa74157

Please sign in to comment.