Skip to content

Commit 67660e3

Browse files
committed
Updated PMD rules, refactored POM so that versions plugin detects new versions of maven plugins only referenced in custom profiles and updated the versions of plugins and dependencies that have new versions. Also updated build checkout commands to work properly with branch protection rules.
1 parent 210197d commit 67660e3

File tree

9 files changed

+57
-31
lines changed

9 files changed

+57
-31
lines changed

.github/workflows/build.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ jobs:
77
runs-on: ubuntu-latest
88

99
steps:
10-
- uses: actions/checkout@v3
10+
- uses: actions/checkout@v4
11+
with:
12+
fetch-depth: 0
13+
persist-credentials: false
1114

1215
- name: Set up JDK 17
1316
uses: actions/setup-java@v3

.github/workflows/latest-versions.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
runs-on: ubuntu-latest
88

99
steps:
10-
- uses: actions/checkout@v3
10+
- uses: actions/checkout@v4
1111

1212
- name: Set up JDK 21
1313
uses: oracle-actions/setup-java@v1

.github/workflows/owasp.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
runs-on: ubuntu-latest
88

99
steps:
10-
- uses: actions/checkout@v3
10+
- uses: actions/checkout@v4
1111

1212
- name: Set up JDK 21
1313
uses: oracle-actions/setup-java@v1

config/checkstyle/google_checks_suppressions.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<suppressions>
66
<!-- Fully Suppressed Rules (all projects) -->
77
<suppress checks="CustomImportOrder" files="." />
8+
<suppress checks="OverloadMethodsDeclarationOrder" files="." />
89

910
<!-- Fully Suppressed Rules (non-library projects only) -->
1011
<suppress checks="MissingJavadocType" files="." />

config/checkstyle/spt_checks.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
<!-- SPT Specific rules -->
3535

3636
<!-- SPT Custom -->
37-
3837
<module name="MatchXpath">
3938
<property name="query" value="//VARIABLE_DEF/TYPE/IDENT[@text='var']"/>
4039
<message key="matchxpath.match" value="The `var` keyword should be avoided to keep the code easier to understand"/>

config/pmd/rulesets/spt-default-rules.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
<rule ref="category/java/bestpractices.xml/AvoidReassigningCatchVariables" />
1414
<rule ref="category/java/bestpractices.xml/AvoidReassigningLoopVariables" />
1515
<rule ref="category/java/bestpractices.xml/AvoidReassigningParameters" />
16-
<rule ref="category/java/bestpractices.xml/AvoidUsingHardCodedIP" />
1716
<rule ref="category/java/bestpractices.xml/ConstantsInInterface" />
1817
<rule ref="category/java/bestpractices.xml/CheckResultSet" />
1918
<rule ref="category/java/bestpractices.xml/DefaultLabelNotLastInSwitchStmt" />
@@ -66,7 +65,6 @@
6665
<rule ref="category/java/design.xml/AvoidRethrowingException" />
6766
<rule ref="category/java/design.xml/AvoidThrowingNewInstanceOfSameException" />
6867
<rule ref="category/java/design.xml/AvoidThrowingNullPointerException" />
69-
<rule ref="category/java/design.xml/AvoidThrowingRawExceptionTypes" />
7068
<rule ref="category/java/design.xml/ClassWithOnlyPrivateConstructorsShouldBeFinal" />
7169
<rule ref="category/java/design.xml/CognitiveComplexity">
7270
<properties>
@@ -112,7 +110,6 @@
112110
<rule ref="category/java/errorprone.xml/AvoidBranchingStatementAsLastInLoop" />
113111
<rule ref="category/java/errorprone.xml/AvoidCatchingNPE" />
114112
<rule ref="category/java/errorprone.xml/AvoidDecimalLiteralsInBigDecimalConstructor" />
115-
<rule ref="category/java/errorprone.xml/AvoidDuplicateLiterals" />
116113
<rule ref="category/java/errorprone.xml/AvoidFieldNameMatchingMethodName" />
117114
<rule ref="category/java/errorprone.xml/AvoidMultipleUnaryOperators" />
118115
<rule ref="category/java/errorprone.xml/AvoidUsingOctalValues" />

config/pmd/rulesets/spt-main-rules.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,16 @@
88
SPT Development main ruleset used by the Maven PMD plugin.
99
</description>
1010

11+
<!-- Best practices: https://pmd.github.io/pmd/pmd_rules_java_bestpractices.html -->
12+
<rule ref="category/java/bestpractices.xml/AvoidUsingHardCodedIP" />
13+
1114
<!-- Code style : https://pmd.github.io/pmd/pmd_rules_java_codestyle.html -->
1215
<!-- NOTE - favour checkstyle for checking code style -->
1316
<rule ref="category/java/codestyle.xml/TooManyStaticImports" />
17+
18+
<!-- Design: https://pmd.github.io/pmd/pmd_rules_java_design.html -->
19+
<rule ref="category/java/design.xml/AvoidThrowingRawExceptionTypes" />
20+
21+
<!-- Error prone: https://pmd.github.io/pmd/pmd_rules_java_errorprone.html -->
22+
<rule ref="category/java/errorprone.xml/AvoidDuplicateLiterals" />
1423
</ruleset>
Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
Version 0.0.1
2-
=============
3-
41
* Demo project, version won't be incremented

pom.xml

Lines changed: 41 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,22 @@
3030
<maven.min.version>3.9.4</maven.min.version>
3131

3232
<!-- Dependency versions -->
33-
<asm.version>9.5</asm.version>
33+
<asm.version>9.6</asm.version>
3434
<commons-compress.version>1.24.0</commons-compress.version>
3535
<commons-collections.version>4.4</commons-collections.version>
3636
<findbugs-jsr305.version>3.0.2</findbugs-jsr305.version>
37-
<guava.version>32.1.2-jre</guava.version>
38-
<spt-development-audit-spring-boot.version>3.1.4</spt-development-audit-spring-boot.version>
39-
<spt-development-cid-jms-spring-boot.version>3.1.4</spt-development-cid-jms-spring-boot.version>
40-
<spt-development-cid-web-spring-boot.version>3.1.4</spt-development-cid-web-spring-boot.version>
41-
<spt-development-logging-spring-boot.version>3.1.4</spt-development-logging-spring-boot.version>
37+
<guava.version>32.1.3-jre</guava.version>
38+
<spt-development-audit-spring-boot.version>3.1.5-SNAPSHOT</spt-development-audit-spring-boot.version>
39+
<spt-development-cid-jms-spring-boot.version>3.1.5-SNAPSHOT</spt-development-cid-jms-spring-boot.version>
40+
<spt-development-cid-web-spring-boot.version>3.1.5-SNAPSHOT</spt-development-cid-web-spring-boot.version>
41+
<spt-development-logging-spring-boot.version>3.1.5-SNAPSHOT</spt-development-logging-spring-boot.version>
4242

4343
<!-- Test dependency versions -->
4444
<awaitility.version>4.2.0</awaitility.version>
4545
<cucumber.version>7.14.0</cucumber.version>
4646
<junit-platform.version>1.10.0</junit-platform.version>
47-
<spt-development-test.version>3.0.10</spt-development-test.version>
48-
<testcontainers.version>1.19.0</testcontainers.version>
47+
<spt-development-test.version>3.1.0-SNAPSHOT</spt-development-test.version>
48+
<testcontainers.version>1.19.1</testcontainers.version>
4949

5050
<!-- Plugin versions -->
5151
<checkstyle-maven-plugin.version>3.3.0</checkstyle-maven-plugin.version>
@@ -55,14 +55,14 @@
5555
<maven-jxr-plugin.version>3.3.0</maven-jxr-plugin.version>
5656
<maven-pmd-plugin.version>3.21.0</maven-pmd-plugin.version>
5757
<maven-scm-plugin.version>2.0.1</maven-scm-plugin.version>
58-
<pitest-maven.version>1.7.2</pitest-maven.version>
58+
<pitest-maven.version>1.15.1</pitest-maven.version>
5959
<spotbugs-plugin.version>4.7.3.6</spotbugs-plugin.version>
6060

6161
<!-- Plugin dependencies -->
62-
<checkstyle.version>10.12.3</checkstyle.version>
62+
<checkstyle.version>10.12.4</checkstyle.version>
6363
<findbugs-sec-bug-pattern.version>1.12.0</findbugs-sec-bug-pattern.version>
6464
<findbugs-slf4j-bug-pattern.version>1.5.0</findbugs-slf4j-bug-pattern.version>
65-
<pitest-junit5-plugin.version>0.15</pitest-junit5-plugin.version>
65+
<pitest-junit5-plugin.version>1.2.0</pitest-junit5-plugin.version>
6666
</properties>
6767

6868
<dependencyManagement>
@@ -282,6 +282,33 @@
282282
</dependencies>
283283

284284
<build>
285+
<pluginManagement>
286+
<plugins>
287+
<!-- Plugins used in custom profiles, added so that new versions are detected yb the versions plugin -->
288+
<plugin>
289+
<artifactId>maven-pmd-plugin</artifactId>
290+
<version>${maven-pmd-plugin.version}</version>
291+
</plugin>
292+
<plugin>
293+
<groupId>org.codehaus.mojo</groupId>
294+
<artifactId>license-maven-plugin</artifactId>
295+
<version>${license-maven-plugin.version}</version>
296+
</plugin>
297+
<plugin>
298+
<groupId>org.pitest</groupId>
299+
<artifactId>pitest-maven</artifactId>
300+
<version>${pitest-maven.version}</version>
301+
<dependencies>
302+
<dependency>
303+
<groupId>org.pitest</groupId>
304+
<artifactId>pitest-junit5-plugin</artifactId>
305+
<version>${pitest-junit5-plugin.version}</version>
306+
</dependency>
307+
</dependencies>
308+
</plugin>
309+
</plugins>
310+
</pluginManagement>
311+
285312
<plugins>
286313
<plugin>
287314
<groupId>org.codehaus.mojo</groupId>
@@ -641,14 +668,6 @@
641668
<plugin>
642669
<groupId>org.pitest</groupId>
643670
<artifactId>pitest-maven</artifactId>
644-
<version>${pitest-maven.version}</version>
645-
<dependencies>
646-
<dependency>
647-
<groupId>org.pitest</groupId>
648-
<artifactId>pitest-junit5-plugin</artifactId>
649-
<version>${pitest-junit5-plugin.version}</version>
650-
</dependency>
651-
</dependencies>
652671
<configuration>
653672
<mutationThreshold>100</mutationThreshold>
654673
<excludedClasses>
@@ -667,10 +686,10 @@
667686
</goals>
668687
</execution>
669688
</executions>
689+
<!-- Version defined in pluginManagement section -->
670690
</plugin>
671691
<plugin>
672692
<artifactId>maven-pmd-plugin</artifactId>
673-
<version>${maven-pmd-plugin.version}</version>
674693
<configuration>
675694
<includeTests>false</includeTests>
676695
<printFailingErrors>true</printFailingErrors>
@@ -714,11 +733,11 @@
714733
</goals>
715734
</execution>
716735
</executions>
736+
<!-- Version defined in pluginManagement section -->
717737
</plugin>
718738
<plugin>
719739
<groupId>org.codehaus.mojo</groupId>
720740
<artifactId>license-maven-plugin</artifactId>
721-
<version>${license-maven-plugin.version}</version>
722741
<executions>
723742
<execution>
724743
<phase>compile</phase>
@@ -769,6 +788,7 @@
769788
</configuration>
770789
</execution>
771790
</executions>
791+
<!-- Version defined in pluginManagement section -->
772792
</plugin>
773793
</plugins>
774794
</build>

0 commit comments

Comments
 (0)