Skip to content

Commit adcdd1c

Browse files
authored
Merge pull request #407 from xdev-software/develop
Release
2 parents a4989ef + ed22c44 commit adcdd1c

File tree

24 files changed

+751
-288
lines changed

24 files changed

+751
-288
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/FUNDING.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
github: Leaflet
2+
open_collective: leafletjs

.github/workflows/checkBuild.yml renamed to .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

.github/workflows/release.yml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ permissions:
1212
pull-requests: write
1313

1414
jobs:
15-
check_code: # Validates the code
15+
check-code:
1616
runs-on: ubuntu-latest
1717
steps:
1818
- uses: actions/checkout@v4
@@ -45,9 +45,9 @@ jobs:
4545
exit 1
4646
fi
4747
48-
prepare_release:
48+
prepare-release:
4949
runs-on: ubuntu-latest
50-
needs: [check_code]
50+
needs: [check-code]
5151
outputs:
5252
upload_url: ${{ steps.create_release.outputs.upload_url }}
5353
steps:
@@ -93,8 +93,8 @@ jobs:
9393
release_name: v${{ steps.version.outputs.release }}
9494
commitish: master
9595
body: |
96-
## [Changelog](https://github.com/xdev-software/${{ env.PRIMARY_MAVEN_MODULE }}/blob/develop/CHANGELOG.md#${{ steps.version.outputs.releasenumber }})
97-
See [Changelog#v${{ steps.version.outputs.release }}](https://github.com/xdev-software/${{ env.PRIMARY_MAVEN_MODULE }}/blob/develop/CHANGELOG.md#${{ steps.version.outputs.releasenumber }}) for more information.
96+
## [Changelog](https://github.com/${{ github.repository }}/blob/develop/CHANGELOG.md#${{ steps.version.outputs.releasenumber }})
97+
See [Changelog#v${{ steps.version.outputs.release }}](https://github.com/${{ github.repository }}/blob/develop/CHANGELOG.md#${{ steps.version.outputs.releasenumber }}) for more information.
9898
9999
## Installation
100100
Add the following lines to your pom:
@@ -109,9 +109,9 @@ jobs:
109109
### Additional notes
110110
* [Spring-Boot] You may have to include ``software/xdev`` inside [``vaadin.allowed-packages``](https://vaadin.com/docs/latest/integrations/spring/configuration#configure-the-scanning-of-packages)
111111
112-
publish_central: # Publish the code to central
112+
publish-maven:
113113
runs-on: ubuntu-latest
114-
needs: [prepare_release]
114+
needs: [prepare-release]
115115
steps:
116116
- uses: actions/checkout@v4
117117

@@ -133,7 +133,7 @@ jobs:
133133
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
134134

135135
- name: Publish to Apache Maven Central
136-
run: ../mvnw -B deploy -Possrh
136+
run: ../mvnw -B deploy -Possrh -DskipTests
137137
env:
138138
MAVEN_CENTRAL_USERNAME: ${{ secrets.S01_OSS_SONATYPE_MAVEN_USERNAME }}
139139
MAVEN_CENTRAL_TOKEN: ${{ secrets.S01_OSS_SONATYPE_MAVEN_TOKEN }}
@@ -142,7 +142,7 @@ jobs:
142142

143143
publish-pages:
144144
runs-on: ubuntu-latest
145-
needs: [prepare_release]
145+
needs: [prepare-release]
146146
steps:
147147
- uses: actions/checkout@v4
148148

@@ -160,7 +160,7 @@ jobs:
160160
cache: 'maven'
161161

162162
- name: Build site
163-
run: ../mvnw -B site
163+
run: ../mvnw -B site -DskipTests
164164
working-directory: ${{ env.PRIMARY_MAVEN_MODULE }}
165165

166166
- name: Deploy to Github pages
@@ -169,9 +169,9 @@ jobs:
169169
github_token: ${{ secrets.GITHUB_TOKEN }}
170170
publish_dir: ./${{ env.PRIMARY_MAVEN_MODULE }}/target/site
171171

172-
after_release:
172+
after-release:
173173
runs-on: ubuntu-latest
174-
needs: [publish_central]
174+
needs: [publish-maven]
175175
steps:
176176
- uses: actions/checkout@v4
177177

@@ -189,7 +189,7 @@ jobs:
189189
for i in "${modules[@]}"
190190
do
191191
echo "Processing $i/pom.xml"
192-
(cd "$i" && $mvnwPath -B build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.nextIncrementalVersion} -DgenerateBackupPoms=false -DnextSnapshot=true)
192+
(cd "$i" && $mvnwPath -B build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.nextIncrementalVersion} -DgenerateBackupPoms=false -DnextSnapshot=true -DupdateMatchingVersions=false)
193193
done
194194
195195
- name: Git Commit and Push

.github/workflows/sonar.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,22 @@ env:
2424
SONARCLOUD_HOST: https://sonarcloud.io
2525

2626
jobs:
27-
sonar:
28-
name: SonarCloud Scan
27+
token-check:
2928
runs-on: ubuntu-latest
30-
if: ${{ github.event_name != 'pull_request' || !startsWith(github.head_ref, 'renovate/') }}
29+
if: ${{ !(github.event_name == 'pull_request' && startsWith(github.head_ref, 'renovate/')) }}
30+
outputs:
31+
hasToken: ${{ steps.check-token.outputs.has }}
32+
steps:
33+
- id: check-token
34+
run: |
35+
[ -z $SONAR_TOKEN ] && echo "has=false" || echo "has=true" >> "$GITHUB_OUTPUT"
36+
env:
37+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
38+
39+
sonar-scan:
40+
runs-on: ubuntu-latest
41+
needs: token-check
42+
if: ${{ needs.token-check.outputs.hasToken }}
3143
steps:
3244
- uses: actions/checkout@v4
3345
with:

.github/workflows/test-deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ env:
77
PRIMARY_MAVEN_MODULE: ${{ github.event.repository.name }}
88

99
jobs:
10-
publish_central: # Publish the code to central
10+
publish-maven:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v4

0 commit comments

Comments
 (0)