Skip to content

Commit 07859e0

Browse files
committed
Merge remote-tracking branch 'origin/update-from-template' into develop
2 parents ca81b25 + 034ee38 commit 07859e0

File tree

11 files changed

+319
-48
lines changed

11 files changed

+319
-48
lines changed

.config/pmd/ruleset.xml

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
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+
<!-- Some override methods or Junit require this -->
63+
<exclude name="SignatureDeclareThrowsException"/>
64+
65+
<!-- Reports FP for equals methods -->
66+
<exclude name="SimplifyBooleanReturns"/>
67+
68+
<!-- Limit too low -->
69+
<exclude name="TooManyFields"/>
70+
71+
<!-- Limit too low -->
72+
<exclude name="TooManyMethods"/>
73+
74+
<!-- Limit too low -->
75+
<exclude name="UseObjectForClearerAPI"/>
76+
77+
<!-- Handled by checkstyle -->
78+
<exclude name="UseUtilityClass"/>
79+
</rule>
80+
81+
<rule ref="category/java/design.xml/AvoidDeeplyNestedIfStmts">
82+
<properties>
83+
<property name="problemDepth" value="4"/>
84+
</properties>
85+
</rule>
86+
<rule ref="category/java/design.xml/CouplingBetweenObjects">
87+
<properties>
88+
<property name="threshold" value="100"/>
89+
</properties>
90+
</rule>
91+
<rule ref="category/java/design.xml/CyclomaticComplexity">
92+
<properties>
93+
<property name="classReportLevel" value="150"/>
94+
<property name="methodReportLevel" value="25"/>
95+
<property name="cycloOptions" value=""/>
96+
</properties>
97+
</rule>
98+
<rule ref="category/java/design.xml/ExcessiveImports">
99+
<properties>
100+
<property name="minimum" value="200"/>
101+
</properties>
102+
</rule>
103+
<rule ref="category/java/design.xml/TooManyFields">
104+
<properties>
105+
<property name="maxfields" value="50"/>
106+
</properties>
107+
</rule>
108+
<rule ref="category/java/design.xml/TooManyMethods">
109+
<properties>
110+
<property name="maxmethods" value="100"/>
111+
</properties>
112+
</rule>
113+
114+
<rule ref="category/java/errorprone.xml/AvoidUsingOctalValues"/>
115+
<rule ref="category/java/errorprone.xml/BrokenNullCheck"/>
116+
<rule ref="category/java/errorprone.xml/ComparisonWithNaN"/>
117+
<rule ref="category/java/errorprone.xml/DoNotCallGarbageCollectionExplicitly"/>
118+
<rule ref="category/java/errorprone.xml/DontImportSun"/>
119+
<rule ref="category/java/errorprone.xml/MisplacedNullCheck"/>
120+
<rule ref="category/java/errorprone.xml/UnnecessaryCaseChange"/>
121+
122+
123+
<rule ref="category/java/multithreading.xml">
124+
<!-- Just bloats code -->
125+
<exclude name="AvoidSynchronizedAtMethodLevel"/>
126+
127+
<!-- NOPE -->
128+
<exclude name="DoNotUseThreads"/>
129+
130+
<!-- Doesn't detect nested thread safe singleton pattern -->
131+
<exclude name="NonThreadSafeSingleton"/>
132+
133+
<!-- Should relevant for fields that use multithreading which is rare -->
134+
<exclude name="UseConcurrentHashMap"/>
135+
</rule>
136+
137+
<rule ref="category/java/performance.xml">
138+
<!-- This was fixed in Java 10 -->
139+
<exclude name="AvoidFileStream"/>
140+
141+
<!-- Used everywhere and has neglectable performance impact -->
142+
<exclude name="AvoidInstantiatingObjectsInLoops"/>
143+
144+
<!-- Handled by checkstyle -->
145+
<exclude name="RedundantFieldInitializer"/>
146+
147+
<!-- Nowadays optimized by compiler; No code bloating needed -->
148+
<exclude name="UseStringBufferForStringAppends"/>
149+
</rule>
150+
151+
<rule ref="category/java/security.xml"/>
152+
</ruleset>

.github/workflows/check-build.yml

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
exit 1
6464
fi
6565
66-
code-style:
66+
checkstyle:
6767
runs-on: ubuntu-latest
6868
if: ${{ github.event_name != 'pull_request' || !startsWith(github.head_ref, 'renovate/') }}
6969

@@ -84,3 +84,40 @@ jobs:
8484

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

.github/workflows/release.yml

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

132132
- name: Publish to Apache Maven Central
133-
run: ../mvnw -B deploy -Possrh
133+
run: ../mvnw -B deploy -Possrh -DskipTests
134134
env:
135135
MAVEN_CENTRAL_USERNAME: ${{ secrets.S01_OSS_SONATYPE_MAVEN_USERNAME }}
136136
MAVEN_CENTRAL_TOKEN: ${{ secrets.S01_OSS_SONATYPE_MAVEN_TOKEN }}
@@ -157,7 +157,7 @@ jobs:
157157
cache: 'maven'
158158

159159
- name: Build site
160-
run: ../mvnw -B site
160+
run: ../mvnw -B site -DskipTests
161161
working-directory: ${{ env.PRIMARY_MAVEN_MODULE }}
162162

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

.github/workflows/update-from-template.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,8 @@ jobs:
211211
echo "Checking if update-branch-merged exists"
212212
git fetch
213213
if [[ $(git rev-parse origin/${{ env.UPDATE_BRANCH_MERGED }}) ]]; then
214+
echo "Branch still exists; Continuing..."
215+
else
214216
echo "Branch origin/${{ env.UPDATE_BRANCH_MERGED }} is missing"
215217
exit 0
216218
fi
@@ -274,6 +276,8 @@ jobs:
274276
echo "Fetching..."
275277
git fetch
276278
if [[ $(git rev-parse origin/${{ env.UPDATE_BRANCH_MERGED }}) ]]; then
279+
echo "Branch still exists; Continuing..."
280+
else
277281
echo "Branch origin/${{ env.UPDATE_BRANCH_MERGED }} is missing"
278282
exit 0
279283
fi

.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

pom.xml

Lines changed: 63 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@
1919
<module>testcontainers-selenium-demo</module>
2020
</modules>
2121

22+
<properties>
23+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
24+
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
25+
</properties>
26+
2227
<licenses>
2328
<license>
2429
<name>Apache License, Version 2.0</name>
@@ -29,20 +34,75 @@
2934

3035
<profiles>
3136
<profile>
32-
<!-- Disable checkstyle in root module as there is nothing to check -->
3337
<id>checkstyle</id>
3438
<build>
3539
<plugins>
3640
<plugin>
3741
<groupId>org.apache.maven.plugins</groupId>
3842
<artifactId>maven-checkstyle-plugin</artifactId>
39-
<version>3.3.1</version>
43+
<version>3.4.0</version>
44+
<dependencies>
45+
<dependency>
46+
<groupId>com.puppycrawl.tools</groupId>
47+
<artifactId>checkstyle</artifactId>
48+
<version>10.17.0</version>
49+
</dependency>
50+
</dependencies>
4051
<configuration>
41-
<skip>true</skip>
52+
<configLocation>.config/checkstyle/checkstyle.xml</configLocation>
53+
<includeTestSourceDirectory>true</includeTestSourceDirectory>
4254
</configuration>
55+
<executions>
56+
<execution>
57+
<goals>
58+
<goal>check</goal>
59+
</goals>
60+
</execution>
61+
</executions>
4362
</plugin>
4463
</plugins>
4564
</build>
4665
</profile>
66+
<profile>
67+
<id>pmd</id>
68+
<build>
69+
<plugins>
70+
<plugin>
71+
<groupId>org.apache.maven.plugins</groupId>
72+
<artifactId>maven-pmd-plugin</artifactId>
73+
<version>3.23.0</version>
74+
<configuration>
75+
<includeTests>true</includeTests>
76+
<printFailingErrors>true</printFailingErrors>
77+
<rulesets>
78+
<ruleset>.config/pmd/ruleset.xml</ruleset>
79+
</rulesets>
80+
</configuration>
81+
<dependencies>
82+
<dependency>
83+
<groupId>net.sourceforge.pmd</groupId>
84+
<artifactId>pmd-core</artifactId>
85+
<version>7.2.0</version>
86+
</dependency>
87+
<dependency>
88+
<groupId>net.sourceforge.pmd</groupId>
89+
<artifactId>pmd-java</artifactId>
90+
<version>7.2.0</version>
91+
</dependency>
92+
</dependencies>
93+
</plugin>
94+
</plugins>
95+
</build>
96+
<reporting>
97+
<plugins>
98+
<!-- Required for reporting -->
99+
<plugin>
100+
<groupId>org.apache.maven.plugins</groupId>
101+
<artifactId>maven-jxr-plugin</artifactId>
102+
<version>3.4.0</version>
103+
</plugin>
104+
</plugins>
105+
</reporting>
106+
</profile>
47107
</profiles>
48108
</project>

renovate.json5

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
33
"rebaseWhen": "behind-base-branch",
44
"packageRules": [
5+
{
6+
"description": "Ignore project internal dependencies",
7+
"packagePattern": "^software.xdev:testcontainers-selenium ",
8+
"datasources": [
9+
"maven"
10+
],
11+
"enabled": false
12+
},
513
{
614
"description": "Group Selenium",
715
"matchPackagePatterns": [

0 commit comments

Comments
 (0)