Skip to content

Commit

Permalink
[ci] Fixes PMD warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
frankfliu committed Aug 23, 2023
1 parent 59af05f commit c0d67cb
Show file tree
Hide file tree
Showing 12 changed files with 15 additions and 9 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/continuous.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ jobs:
run: ./gradlew :engines:paddlepaddle:paddlepaddle-native:compileJNI
- name: Test ONNX Runtime
run: |
./gradlew -Dai.djl.default_engine=OnnxRuntime :integration:test
./gradlew --stacktrace -Dai.djl.default_engine=OnnxRuntime :integration:test
./gradlew :integration:clean
- name: Build with Gradle
run: ./gradlew build :jacoco:testCodeCoverageReport
run: ./gradlew --stacktrace build :jacoco:testCodeCoverageReport
- name: Upload test results
uses: actions/upload-artifact@v3
if: always()
Expand Down Expand Up @@ -158,6 +158,6 @@ jobs:
- name: Integration tests
# MXNet integration test on Github Action fail due to memory limitation on Windows
run: |
./gradlew -Pjni "-Dai.djl.default_engine=PyTorch" test -x examples:test
./gradlew -Pjni --rerun-tasks "-Dai.djl.default_engine=TensorFlow" test -x examples:test
./gradlew --rerun-tasks "-Dai.djl.default_engine=OnnxRuntime" :integration:test
./gradlew -Pjni "-Dai.djl.default_engine=PyTorch" --stacktrace test -x examples:test
./gradlew -Pjni --rerun-tasks --stacktrace "-Dai.djl.default_engine=TensorFlow" test -x examples:test
./gradlew --rerun-tasks --stacktrace "-Dai.djl.default_engine=OnnxRuntime" :integration:test
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 c0d67cb

Please sign in to comment.