Skip to content

Commit 95fb17e

Browse files
committed
Merge remote-tracking branch 'origin/update-from-template' into develop
2 parents b7afcde + 8a03acb commit 95fb17e

File tree

11 files changed

+354
-20
lines changed

11 files changed

+354
-20
lines changed

.config/pmd/ruleset.xml

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ruleset name="Default"
3+
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.io/ruleset_2_0_0.xsd">
6+
7+
<description>
8+
This ruleset checks the code for discouraged programming constructs.
9+
</description>
10+
11+
<!-- Only rules that don't overlap with CheckStyle! -->
12+
13+
<rule ref="category/java/bestpractices.xml/AvoidUsingHardCodedIP"/>
14+
<rule ref="category/java/bestpractices.xml/PreserveStackTrace"/>
15+
<rule ref="category/java/bestpractices.xml/UseCollectionIsEmpty"/>
16+
<rule ref="category/java/bestpractices.xml/UseStandardCharsets"/>
17+
18+
<!-- Native code is platform dependent; Loading external native libs might pose a security threat -->
19+
<rule ref="category/java/codestyle.xml/AvoidUsingNativeCode"/>
20+
<rule ref="category/java/codestyle.xml/IdenticalCatchBranches"/>
21+
<rule ref="category/java/codestyle.xml/NoPackage"/>
22+
<rule ref="category/java/codestyle.xml/PrematureDeclaration"/>
23+
24+
<rule ref="category/java/design.xml">
25+
<!-- Sometimes abstract classes have just fields -->
26+
<exclude name="AbstractClassWithoutAnyMethod"/>
27+
28+
<!-- Using RuntimeExceptions is ok -->
29+
<exclude name="AvoidCatchingGenericException"/>
30+
<exclude name="AvoidThrowingRawExceptionTypes"/>
31+
32+
<!-- Limit too low -->
33+
<exclude name="AvoidDeeplyNestedIfStmts"/>
34+
35+
<!-- Limit too low -->
36+
<exclude name="CouplingBetweenObjects"/>
37+
38+
<!-- Limit too low -->
39+
<exclude name="CyclomaticComplexity"/>
40+
41+
<!-- Makes entity classes impossible -->
42+
<exclude name="DataClass"/>
43+
44+
<!-- Used commonly particular in bigger methods with upstream throws -->
45+
<exclude name="ExceptionAsFlowControl"/>
46+
47+
<!-- Limit too low -->
48+
<exclude name="ExcessiveImports"/>
49+
50+
<!-- Handled by TooManyFields/TooManyMethods -->
51+
<exclude name="ExcessivePublicCount"/>
52+
53+
<!-- Prohibits accessing members using multiple depths -->
54+
<exclude name="LawOfDemeter"/>
55+
56+
<!-- No effect -->
57+
<exclude name="LoosePackageCoupling"/>
58+
59+
<!-- Prohibits singleton pattern -->
60+
<exclude name="MutableStaticState"/>
61+
62+
<!-- Checks LoC, already handled by Checkstyle -->
63+
<exclude name="NcssCount"/>
64+
65+
<!-- Some override methods or Junit require this -->
66+
<exclude name="SignatureDeclareThrowsException"/>
67+
68+
<!-- Reports FP for equals methods -->
69+
<exclude name="SimplifyBooleanReturns"/>
70+
71+
<!-- Limit too low -->
72+
<exclude name="TooManyFields"/>
73+
74+
<!-- Limit too low -->
75+
<exclude name="TooManyMethods"/>
76+
77+
<!-- Limit too low -->
78+
<exclude name="UseObjectForClearerAPI"/>
79+
80+
<!-- Handled by checkstyle -->
81+
<exclude name="UseUtilityClass"/>
82+
</rule>
83+
84+
<rule ref="category/java/design.xml/AvoidDeeplyNestedIfStmts">
85+
<properties>
86+
<property name="problemDepth" value="4"/>
87+
</properties>
88+
</rule>
89+
<rule ref="category/java/design.xml/CouplingBetweenObjects">
90+
<properties>
91+
<property name="threshold" value="100"/>
92+
</properties>
93+
</rule>
94+
<rule ref="category/java/design.xml/CyclomaticComplexity">
95+
<properties>
96+
<property name="classReportLevel" value="150"/>
97+
<property name="methodReportLevel" value="25"/>
98+
<property name="cycloOptions" value=""/>
99+
</properties>
100+
</rule>
101+
<rule ref="category/java/design.xml/ExcessiveImports">
102+
<properties>
103+
<property name="minimum" value="200"/>
104+
</properties>
105+
</rule>
106+
<rule ref="category/java/design.xml/TooManyFields">
107+
<properties>
108+
<property name="maxfields" value="50"/>
109+
</properties>
110+
</rule>
111+
<rule ref="category/java/design.xml/TooManyMethods">
112+
<properties>
113+
<property name="maxmethods" value="100"/>
114+
</properties>
115+
</rule>
116+
117+
<rule ref="category/java/errorprone.xml/AvoidUsingOctalValues"/>
118+
<rule ref="category/java/errorprone.xml/BrokenNullCheck"/>
119+
<rule ref="category/java/errorprone.xml/ComparisonWithNaN"/>
120+
<rule ref="category/java/errorprone.xml/DoNotCallGarbageCollectionExplicitly"/>
121+
<rule ref="category/java/errorprone.xml/DontImportSun"/>
122+
<rule ref="category/java/errorprone.xml/MisplacedNullCheck"/>
123+
<rule ref="category/java/errorprone.xml/UnnecessaryCaseChange"/>
124+
125+
126+
<rule ref="category/java/multithreading.xml">
127+
<!-- Just bloats code -->
128+
<exclude name="AvoidSynchronizedAtMethodLevel"/>
129+
130+
<!-- NOPE -->
131+
<exclude name="DoNotUseThreads"/>
132+
133+
<!-- Doesn't detect nested thread safe singleton pattern -->
134+
<exclude name="NonThreadSafeSingleton"/>
135+
136+
<!-- Should relevant for fields that use multithreading which is rare -->
137+
<exclude name="UseConcurrentHashMap"/>
138+
</rule>
139+
140+
<rule ref="category/java/performance.xml">
141+
<!-- This was fixed in Java 10 -->
142+
<exclude name="AvoidFileStream"/>
143+
144+
<!-- Used everywhere and has neglectable performance impact -->
145+
<exclude name="AvoidInstantiatingObjectsInLoops"/>
146+
147+
<!-- Handled by checkstyle -->
148+
<exclude name="RedundantFieldInitializer"/>
149+
150+
<!-- Nowadays optimized by compiler; No code bloating needed -->
151+
<exclude name="UseStringBufferForStringAppends"/>
152+
</rule>
153+
154+
<rule ref="category/java/security.xml"/>
155+
</ruleset>

.github/workflows/check-build.yml

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ on:
1919
- '.idea/**'
2020
- 'assets/**'
2121

22-
env:
23-
PRIMARY_MAVEN_MODULE: ${{ github.event.repository.name }}
24-
2522
jobs:
2623
build:
2724
runs-on: ubuntu-latest
@@ -62,7 +59,7 @@ jobs:
6259
exit 1
6360
fi
6461
65-
code-style:
62+
checkstyle:
6663
runs-on: ubuntu-latest
6764
if: ${{ github.event_name != 'pull_request' || !startsWith(github.head_ref, 'renovate/') }}
6865

@@ -83,3 +80,40 @@ jobs:
8380

8481
- name: Run Checkstyle
8582
run: ./mvnw -B checkstyle:check -P checkstyle -T2C
83+
84+
pmd:
85+
runs-on: ubuntu-latest
86+
if: ${{ github.event_name != 'pull_request' || !startsWith(github.head_ref, 'renovate/') }}
87+
88+
strategy:
89+
matrix:
90+
java: [17]
91+
distribution: [temurin]
92+
93+
steps:
94+
- uses: actions/checkout@v4
95+
96+
- name: Set up JDK
97+
uses: actions/setup-java@v4
98+
with:
99+
distribution: ${{ matrix.distribution }}
100+
java-version: ${{ matrix.java }}
101+
cache: 'maven'
102+
103+
- name: Run PMD
104+
run: ./mvnw -B test pmd:aggregate-pmd-no-fork pmd:check -P pmd -DskipTests -T2C
105+
106+
- name: Run CPD (Copy Paste Detector)
107+
run: ./mvnw -B pmd:aggregate-cpd pmd:cpd-check -P pmd -DskipTests -T2C
108+
109+
- name: Upload report
110+
if: always()
111+
uses: actions/upload-artifact@v4
112+
with:
113+
name: pmd-report
114+
if-no-files-found: ignore
115+
path: |
116+
target/site/*.html
117+
target/site/css/**
118+
target/site/images/logos/maven-feather.png
119+
target/site/images/external.png

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ jobs:
128128
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
129129

130130
- name: Publish to Apache Maven Central
131-
run: ../mvnw -B deploy -Possrh
131+
run: ../mvnw -B deploy -Possrh -DskipTests
132132
env:
133133
MAVEN_CENTRAL_USERNAME: ${{ secrets.S01_OSS_SONATYPE_MAVEN_USERNAME }}
134134
MAVEN_CENTRAL_TOKEN: ${{ secrets.S01_OSS_SONATYPE_MAVEN_TOKEN }}
@@ -155,7 +155,7 @@ jobs:
155155
cache: 'maven'
156156

157157
- name: Build site
158-
run: ../mvnw -B site
158+
run: ../mvnw -B compile site -DskipTests -T2C
159159
working-directory: ${{ env.PRIMARY_MAVEN_MODULE }}
160160

161161
- name: Deploy to Github pages
@@ -184,7 +184,7 @@ jobs:
184184
for i in "${modules[@]}"
185185
do
186186
echo "Processing $i/pom.xml"
187-
(cd "$i" && $mvnwPath -B build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.nextIncrementalVersion} -DgenerateBackupPoms=false -DnextSnapshot=true)
187+
(cd "$i" && $mvnwPath -B build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.nextIncrementalVersion} -DgenerateBackupPoms=false -DnextSnapshot=true -DupdateMatchingVersions=false)
188188
done
189189
190190
- name: Git Commit and Push

.github/workflows/test-deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
2525

2626
- name: Publish to OSSRH
27-
run: ../mvnw -B deploy -Possrh
27+
run: ../mvnw -B deploy -Possrh -DskipTests
2828
working-directory: ${{ env.PRIMARY_MAVEN_MODULE }}
2929
env:
3030
MAVEN_CENTRAL_USERNAME: ${{ secrets.S01_OSS_SONATYPE_MAVEN_USERNAME }}

.gitignore

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,6 @@ buildNumber.properties
3939
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
4040
hs_err_pid*
4141

42-
43-
# bin / compiled stuff
44-
target/
45-
46-
4742
# JRebel
4843
**/resources/rebel.xml
4944
**/resources/rebel-remote.xml

.idea/saveactions_settings.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.mvn/wrapper/maven-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414
# KIND, either express or implied. See the License for the
1515
# specific language governing permissions and limitations
1616
# under the License.
17-
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.7/apache-maven-3.9.7-bin.zip
17+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.8/apache-maven-3.9.8-bin.zip

CONTRIBUTING.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,31 @@ If the ``develop`` is ready for release, create a pull request to the ``master``
4444

4545
When the release is finished do the following:
4646
* Merge the auto-generated PR (with the incremented version number) back into the ``develop``
47+
48+
### Release failures
49+
50+
There are 2 modes of release failure:
51+
1. The remote server was e.g. down and non of the artifacts got published
52+
2. There was a build failure during release and only parts of the artifacts got released
53+
54+
In case 1 we can re-release the existing version,<br/>in case 2 we have to release a new version when we can't get the artifacts deleted (as is the case with Maven Central)
55+
56+
#### How-to: Re-Releasing an existing version
57+
58+
1. Delete the release on GitHub
59+
2. Delete the release Git tag from the repo (locally and remote!)
60+
3. Delete the ``master``-Branch and re-create it from the ``develop`` branch (or reset it to the state before the release-workflow commits have been done)
61+
* This requires __temporarily__ removing the branch protection
62+
* Once this was done a new release is triggered immediately!
63+
64+
#### How-to: Releasing a new version
65+
66+
1. Merge the ``master`` branch back into ``develop`` (or another temporary branch)
67+
2. Make sure all master branch versions are prepared for a new release<br/>e.g. if the broken release was ``1.0.0`` the version should now be at ``1.0.1-SNAPSHOT`` - the ``SNAPSHOT`` is important for the workflow!
68+
3. Mark the broken release as broken e.g. inside the Changelog, GitHub Release page, etc.<br/>
69+
You can use something like this:
70+
```
71+
> [!WARNING]
72+
> This release is broken as my cat accidentally clicked the abort button during the process
73+
```
74+
4. Merge the changes back into the ``master`` branch to trigger a new release

pom.xml

Lines changed: 62 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818
<module>spring-data-eclipse-store-migration</module>
1919
</modules>
2020

21+
<properties>
22+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
23+
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
24+
</properties>
25+
2126
<licenses>
2227
<license>
2328
<name>Apache License, Version 2.0</name>
@@ -28,20 +33,75 @@
2833

2934
<profiles>
3035
<profile>
31-
<!-- Disable checkstyle in root module as there is nothing to check -->
3236
<id>checkstyle</id>
3337
<build>
3438
<plugins>
3539
<plugin>
3640
<groupId>org.apache.maven.plugins</groupId>
3741
<artifactId>maven-checkstyle-plugin</artifactId>
3842
<version>3.4.0</version>
43+
<dependencies>
44+
<dependency>
45+
<groupId>com.puppycrawl.tools</groupId>
46+
<artifactId>checkstyle</artifactId>
47+
<version>10.17.0</version>
48+
</dependency>
49+
</dependencies>
50+
<configuration>
51+
<configLocation>.config/checkstyle/checkstyle.xml</configLocation>
52+
<includeTestSourceDirectory>true</includeTestSourceDirectory>
53+
</configuration>
54+
<executions>
55+
<execution>
56+
<goals>
57+
<goal>check</goal>
58+
</goals>
59+
</execution>
60+
</executions>
61+
</plugin>
62+
</plugins>
63+
</build>
64+
</profile>
65+
<profile>
66+
<id>pmd</id>
67+
<build>
68+
<plugins>
69+
<plugin>
70+
<groupId>org.apache.maven.plugins</groupId>
71+
<artifactId>maven-pmd-plugin</artifactId>
72+
<version>3.24.0</version>
3973
<configuration>
40-
<skip>true</skip>
74+
<includeTests>true</includeTests>
75+
<printFailingErrors>true</printFailingErrors>
76+
<rulesets>
77+
<ruleset>.config/pmd/ruleset.xml</ruleset>
78+
</rulesets>
4179
</configuration>
80+
<dependencies>
81+
<dependency>
82+
<groupId>net.sourceforge.pmd</groupId>
83+
<artifactId>pmd-core</artifactId>
84+
<version>7.4.0</version>
85+
</dependency>
86+
<dependency>
87+
<groupId>net.sourceforge.pmd</groupId>
88+
<artifactId>pmd-java</artifactId>
89+
<version>7.4.0</version>
90+
</dependency>
91+
</dependencies>
4292
</plugin>
4393
</plugins>
4494
</build>
95+
<reporting>
96+
<plugins>
97+
<!-- Required for reporting -->
98+
<plugin>
99+
<groupId>org.apache.maven.plugins</groupId>
100+
<artifactId>maven-jxr-plugin</artifactId>
101+
<version>3.4.0</version>
102+
</plugin>
103+
</plugins>
104+
</reporting>
45105
</profile>
46106
</profiles>
47107
</project>

0 commit comments

Comments
 (0)