Skip to content

Commit d5ed464

Browse files
committed
Merge remote-tracking branch 'origin/update-from-template' into develop
2 parents 0de314c + 98b2e91 commit d5ed464

File tree

8 files changed

+312
-44
lines changed

8 files changed

+312
-44
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
@@ -70,7 +70,7 @@ jobs:
7070
path: ${{ env.DEMO_MAVEN_MODULE }}/target/${{ env.DEMO_MAVEN_MODULE }}.jar
7171
if-no-files-found: error
7272

73-
code-style:
73+
checkstyle:
7474
runs-on: ubuntu-latest
7575
if: ${{ github.event_name != 'pull_request' || !startsWith(github.head_ref, 'renovate/') }}
7676

@@ -91,3 +91,40 @@ jobs:
9191

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

.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

.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

dynamicreports-core-for-grid-exporter-demo/pom.xml

Lines changed: 6 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@
44
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
55
<modelVersion>4.0.0</modelVersion>
66

7-
<groupId>software.xdev</groupId>
7+
<parent>
8+
<groupId>software.xdev</groupId>
9+
<artifactId>dynamicreports-core-for-grid-exporter-root</artifactId>
10+
<version>1.1.3-SNAPSHOT</version>
11+
</parent>
12+
813
<artifactId>dynamicreports-core-for-grid-exporter-demo</artifactId>
914
<version>1.1.3-SNAPSHOT</version>
1015
<packaging>jar</packaging>
@@ -77,36 +82,4 @@
7782
</plugin>
7883
</plugins>
7984
</build>
80-
<profiles>
81-
<profile>
82-
<id>checkstyle</id>
83-
<build>
84-
<plugins>
85-
<plugin>
86-
<groupId>org.apache.maven.plugins</groupId>
87-
<artifactId>maven-checkstyle-plugin</artifactId>
88-
<version>3.4.0</version>
89-
<dependencies>
90-
<dependency>
91-
<groupId>com.puppycrawl.tools</groupId>
92-
<artifactId>checkstyle</artifactId>
93-
<version>10.17.0</version>
94-
</dependency>
95-
</dependencies>
96-
<configuration>
97-
<configLocation>../.config/checkstyle/checkstyle.xml</configLocation>
98-
<includeTestSourceDirectory>true</includeTestSourceDirectory>
99-
</configuration>
100-
<executions>
101-
<execution>
102-
<goals>
103-
<goal>check</goal>
104-
</goals>
105-
</execution>
106-
</executions>
107-
</plugin>
108-
</plugins>
109-
</build>
110-
</profile>
111-
</profiles>
11285
</project>

dynamicreports-core-for-grid-exporter/pom.xml

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@
125125
<plugin>
126126
<groupId>org.apache.maven.plugins</groupId>
127127
<artifactId>maven-project-info-reports-plugin</artifactId>
128-
<version>3.5.0</version>
128+
<version>3.6.1</version>
129129
</plugin>
130130
</plugins>
131131
</pluginManagement>
@@ -300,5 +300,46 @@
300300
</plugins>
301301
</build>
302302
</profile>
303+
<profile>
304+
<id>pmd</id>
305+
<build>
306+
<plugins>
307+
<plugin>
308+
<groupId>org.apache.maven.plugins</groupId>
309+
<artifactId>maven-pmd-plugin</artifactId>
310+
<version>3.23.0</version>
311+
<configuration>
312+
<includeTests>true</includeTests>
313+
<printFailingErrors>true</printFailingErrors>
314+
<rulesets>
315+
<ruleset>../.config/pmd/ruleset.xml</ruleset>
316+
</rulesets>
317+
</configuration>
318+
<dependencies>
319+
<dependency>
320+
<groupId>net.sourceforge.pmd</groupId>
321+
<artifactId>pmd-core</artifactId>
322+
<version>7.2.0</version>
323+
</dependency>
324+
<dependency>
325+
<groupId>net.sourceforge.pmd</groupId>
326+
<artifactId>pmd-java</artifactId>
327+
<version>7.2.0</version>
328+
</dependency>
329+
</dependencies>
330+
</plugin>
331+
</plugins>
332+
</build>
333+
<reporting>
334+
<plugins>
335+
<!-- Required for reporting -->
336+
<plugin>
337+
<groupId>org.apache.maven.plugins</groupId>
338+
<artifactId>maven-jxr-plugin</artifactId>
339+
<version>3.4.0</version>
340+
</plugin>
341+
</plugins>
342+
</reporting>
343+
</profile>
303344
</profiles>
304345
</project>

0 commit comments

Comments
 (0)