Skip to content

Commit 6e38e60

Browse files
authored
Merge pull request #214 from xdev-software/develop
Release
2 parents 1f14892 + 774d94e commit 6e38e60

File tree

24 files changed

+218
-57
lines changed

24 files changed

+218
-57
lines changed

.config/checkstyle/checkstyle.xml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
<module name="TreeWalker">
5353
<!-- Checks - sorted alphabetically -->
5454
<module name="ArrayTypeStyle"/>
55+
<module name="AvoidDoubleBraceInitialization"/>
5556
<module name="AvoidStarImport"/>
5657
<module name="ConstantName"/>
5758
<module name="DefaultComesLast"/>
@@ -68,6 +69,11 @@
6869
<module name="FinalParameters"/>
6970
<module name="GenericWhitespace"/>
7071
<module name="HideUtilityClassConstructor"/>
72+
<module name="IllegalCatch">
73+
<!-- https://docs.pmd-code.org/pmd-doc-7.11.0/pmd_rules_java_errorprone.html#avoidcatchingnpe -->
74+
<!-- https://docs.pmd-code.org/pmd-doc-7.11.0/pmd_rules_java_errorprone.html#avoidcatchingthrowable -->
75+
<property name="illegalClassNames" value="Error,Throwable,NullPointerException,java.lang.Error,java.lang.Throwable,java.lang.NullPointerException"/>
76+
</module>
7177
<module name="IllegalImport"/>
7278
<module name="InterfaceIsType"/>
7379
<module name="JavadocStyle">
@@ -93,7 +99,6 @@
9399
<module name="MethodParamPad"/>
94100
<module name="MissingDeprecated"/>
95101
<module name="MissingOverride"/>
96-
<module name="MissingSwitchDefault"/>
97102
<module name="ModifierOrder"/>
98103
<module name="NeedBraces"/>
99104
<module name="NoClone"/>
@@ -122,7 +127,13 @@
122127
</module>
123128
<module name="TypecastParenPad"/>
124129
<module name="TypeName"/>
130+
<module name="UnnecessaryParentheses"/>
131+
<module name="UnnecessarySemicolonAfterOuterTypeDeclaration"/>
132+
<module name="UnnecessarySemicolonAfterTypeMemberDeclaration"/>
133+
<module name="UnnecessarySemicolonInEnumeration"/>
134+
<module name="UnnecessarySemicolonInTryWithResources"/>
125135
<module name="UnusedImports"/>
136+
<module name="UnusedLocalVariable"/>
126137
<module name="UpperEll"/>
127138
<module name="VisibilityModifier">
128139
<property name="packageAllowed" value="true"/>

.config/pmd/ruleset.xml

Lines changed: 70 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,38 @@
1010

1111
<!-- Only rules that don't overlap with CheckStyle! -->
1212

13+
<rule ref="category/java/bestpractices.xml/AvoidPrintStackTrace"/>
14+
<rule ref="category/java/bestpractices.xml/AvoidStringBufferField"/>
1315
<rule ref="category/java/bestpractices.xml/AvoidUsingHardCodedIP"/>
16+
<rule ref="category/java/bestpractices.xml/ConstantsInInterface"/>
17+
<rule ref="category/java/bestpractices.xml/ExhaustiveSwitchHasDefault"/>
18+
<rule ref="category/java/bestpractices.xml/LiteralsFirstInComparisons"/>
19+
<!-- CheckStyle can't handle this switch behavior -> delegated to PMD -->
20+
<rule ref="category/java/bestpractices.xml/NonExhaustiveSwitch"/>
21+
<rule ref="category/java/bestpractices.xml/OneDeclarationPerLine">
22+
<properties>
23+
<property name="strictMode" value="true"/>
24+
</properties>
25+
</rule>
1426
<rule ref="category/java/bestpractices.xml/PreserveStackTrace"/>
27+
<rule ref="category/java/bestpractices.xml/SimplifiableTestAssertion"/>
28+
<rule ref="category/java/bestpractices.xml/SystemPrintln"/>
29+
<rule ref="category/java/bestpractices.xml/UnusedAssignment"/>
30+
<rule ref="category/java/bestpractices.xml/UnusedFormalParameter"/>
31+
<rule ref="category/java/bestpractices.xml/UnusedPrivateField"/>
32+
<rule ref="category/java/bestpractices.xml/UnusedPrivateMethod"/>
1533
<rule ref="category/java/bestpractices.xml/UseCollectionIsEmpty"/>
34+
<rule ref="category/java/bestpractices.xml/UseEnumCollections"/>
1635
<rule ref="category/java/bestpractices.xml/UseStandardCharsets"/>
36+
<rule ref="category/java/bestpractices.xml/UseTryWithResources"/>
1737

1838
<!-- Native code is platform dependent; Loading external native libs might pose a security threat -->
1939
<rule ref="category/java/codestyle.xml/AvoidUsingNativeCode"/>
2040
<rule ref="category/java/codestyle.xml/IdenticalCatchBranches"/>
41+
<rule ref="category/java/codestyle.xml/LambdaCanBeMethodReference"/>
2142
<rule ref="category/java/codestyle.xml/NoPackage"/>
2243
<rule ref="category/java/codestyle.xml/PrematureDeclaration"/>
44+
<rule ref="category/java/codestyle.xml/UnnecessarySemicolon"/>
2345

2446
<rule ref="category/java/design.xml">
2547
<!-- Sometimes abstract classes have just fields -->
@@ -59,6 +81,9 @@
5981
<!-- Prohibits singleton pattern -->
6082
<exclude name="MutableStaticState"/>
6183

84+
<!-- Checks LoC, already handled by Checkstyle -->
85+
<exclude name="NcssCount"/>
86+
6287
<!-- Some override methods or Junit require this -->
6388
<exclude name="SignatureDeclareThrowsException"/>
6489

@@ -73,9 +98,6 @@
7398

7499
<!-- Limit too low -->
75100
<exclude name="UseObjectForClearerAPI"/>
76-
77-
<!-- Handled by checkstyle -->
78-
<exclude name="UseUtilityClass"/>
79101
</rule>
80102

81103
<rule ref="category/java/design.xml/AvoidDeeplyNestedIfStmts">
@@ -111,17 +133,33 @@
111133
</properties>
112134
</rule>
113135

136+
<rule ref="category/java/errorprone.xml/AssignmentToNonFinalStatic"/>
137+
<rule ref="category/java/errorprone.xml/AvoidDecimalLiteralsInBigDecimalConstructor"/>
138+
<rule ref="category/java/errorprone.xml/AvoidMultipleUnaryOperators"/>
114139
<rule ref="category/java/errorprone.xml/AvoidUsingOctalValues"/>
115140
<rule ref="category/java/errorprone.xml/BrokenNullCheck"/>
116141
<rule ref="category/java/errorprone.xml/ComparisonWithNaN"/>
117142
<rule ref="category/java/errorprone.xml/DoNotCallGarbageCollectionExplicitly"/>
118143
<rule ref="category/java/errorprone.xml/DontImportSun"/>
144+
<rule ref="category/java/errorprone.xml/DontUseFloatTypeForLoopIndices"/>
145+
<rule ref="category/java/errorprone.xml/EqualsNull"/>
146+
<rule ref="category/java/errorprone.xml/IdempotentOperations"/>
147+
<rule ref="category/java/errorprone.xml/ImplicitSwitchFallThrough"/>
148+
<rule ref="category/java/errorprone.xml/InstantiationToGetClass"/>
149+
<rule ref="category/java/errorprone.xml/InvalidLogMessageFormat"/>
150+
<rule ref="category/java/errorprone.xml/JumbledIncrementer"/>
119151
<rule ref="category/java/errorprone.xml/MisplacedNullCheck"/>
152+
<rule ref="category/java/errorprone.xml/MoreThanOneLogger"/>
153+
<rule ref="category/java/errorprone.xml/NonStaticInitializer"/>
154+
<rule ref="category/java/errorprone.xml/ReturnFromFinallyBlock"/>
155+
<rule ref="category/java/errorprone.xml/SingletonClassReturningNewInstance"/>
156+
<rule ref="category/java/errorprone.xml/UnconditionalIfStatement"/>
120157
<rule ref="category/java/errorprone.xml/UnnecessaryCaseChange"/>
158+
<rule ref="category/java/errorprone.xml/UselessOperationOnImmutable"/>
121159

122160

123161
<rule ref="category/java/multithreading.xml">
124-
<!-- Just bloats code -->
162+
<!-- Just bloats code; improved in JEP-491/Java 24+ -->
125163
<exclude name="AvoidSynchronizedAtMethodLevel"/>
126164

127165
<!-- NOPE -->
@@ -148,5 +186,33 @@
148186
<exclude name="UseStringBufferForStringAppends"/>
149187
</rule>
150188

189+
<rule ref="category/java/performance.xml/TooFewBranchesForSwitch">
190+
<properties>
191+
<!-- If you have one case only please use a if -->
192+
<property name="minimumNumberCaseForASwitch" value="2"/>
193+
</properties>
194+
</rule>
195+
151196
<rule ref="category/java/security.xml"/>
197+
198+
<rule name="VaadinNativeHTMLUnsafe"
199+
language="java"
200+
message="Unescaped native HTML is unsafe and will result in XSS vulnerabilities"
201+
class="net.sourceforge.pmd.lang.rule.xpath.XPathRule" >
202+
<description>
203+
Do not used native HTML! Use Vaadin layouts and components to create required structure.
204+
If you are 100% sure that you escaped the value properly and you have no better options you can suppress this.
205+
</description>
206+
<priority>2</priority>
207+
<properties>
208+
<property name="xpath">
209+
<value>
210+
<![CDATA[
211+
//ConstructorCall[pmd-java:typeIs('com.vaadin.flow.component.Html')] |
212+
//MethodCall[@MethodName='setAttribute' and //ImportDeclaration[starts-with(@PackageName,'com.vaadin')]]/ArgumentList/StringLiteral[1][contains(lower-case(@Image),'html')]
213+
]]>
214+
</value>
215+
</property>
216+
</properties>
217+
</rule>
152218
</ruleset>

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: 🐞 Bug
22
description: Create a bug report for something that is broken
33
labels: [bug]
4+
type: bug
45
body:
56
- type: markdown
67
attributes:

.github/ISSUE_TEMPLATE/enhancement.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: ✨ Feature/Enhancement
22
description: Suggest a new feature or enhancement
33
labels: [enhancement]
4+
type: feature
45
body:
56
- type: markdown
67
attributes:

.github/workflows/broken-links.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,17 @@ permissions:
1111
jobs:
1212
link-checker:
1313
runs-on: ubuntu-latest
14+
timeout-minutes: 15
1415
steps:
1516
- uses: actions/checkout@v4
1617

1718
- run: mv .github/.lycheeignore .lycheeignore
1819

1920
- name: Link Checker
2021
id: lychee
21-
uses: lycheeverse/lychee-action@v1
22+
uses: lycheeverse/lychee-action@1d97d84f0bc547f7b25f4c2170d87d810dc2fb2c # v2
23+
with:
24+
fail: false # Don't fail on broken links, create an issue instead
2225

2326
- name: Find already existing issue
2427
id: find-issue
@@ -35,7 +38,7 @@ jobs:
3538

3639
- name: Create Issue From File
3740
if: env.lychee_exit_code != 0
38-
uses: peter-evans/create-issue-from-file@v5
41+
uses: peter-evans/create-issue-from-file@e8ef132d6df98ed982188e460ebb3b5d4ef3a9cd # v5
3942
with:
4043
issue-number: ${{ steps.find-issue.outputs.number }}
4144
title: Link Checker Report

.github/workflows/check-build.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ env:
2626
jobs:
2727
build:
2828
runs-on: ubuntu-latest
29+
timeout-minutes: 30
2930

3031
strategy:
3132
matrix:
@@ -73,6 +74,7 @@ jobs:
7374
checkstyle:
7475
runs-on: ubuntu-latest
7576
if: ${{ github.event_name != 'pull_request' || !startsWith(github.head_ref, 'renovate/') }}
77+
timeout-minutes: 15
7678

7779
strategy:
7880
matrix:
@@ -95,6 +97,7 @@ jobs:
9597
pmd:
9698
runs-on: ubuntu-latest
9799
if: ${{ github.event_name != 'pull_request' || !startsWith(github.head_ref, 'renovate/') }}
100+
timeout-minutes: 15
98101

99102
strategy:
100103
matrix:
@@ -124,7 +127,4 @@ jobs:
124127
name: pmd-report
125128
if-no-files-found: ignore
126129
path: |
127-
target/site/*.html
128-
target/site/css/**
129-
target/site/images/logos/maven-feather.png
130-
target/site/images/external.png
130+
target/reports/**

.github/workflows/release.yml

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ permissions:
1414
jobs:
1515
check-code:
1616
runs-on: ubuntu-latest
17+
timeout-minutes: 30
1718
steps:
1819
- uses: actions/checkout@v4
1920

@@ -25,7 +26,7 @@ jobs:
2526
cache: 'maven'
2627

2728
- name: Build with Maven
28-
run: ./mvnw -B clean package -Pproduction
29+
run: ./mvnw -B clean package -Pproduction -T2C
2930

3031
- name: Check for uncommited changes
3132
run: |
@@ -48,6 +49,7 @@ jobs:
4849
prepare-release:
4950
runs-on: ubuntu-latest
5051
needs: [check-code]
52+
timeout-minutes: 10
5153
outputs:
5254
upload_url: ${{ steps.create_release.outputs.upload_url }}
5355
steps:
@@ -62,7 +64,7 @@ jobs:
6264
run: |
6365
mvnwPath=$(readlink -f ./mvnw)
6466
modules=("") # root
65-
modules+=($(grep -ozP '(?<=module>)[^<]+' 'pom.xml' | tr -d '\0'))
67+
modules+=($(grep -oP '(?<=<module>)[^<]+' 'pom.xml'))
6668
for i in "${modules[@]}"
6769
do
6870
echo "Processing $i/pom.xml"
@@ -87,7 +89,7 @@ jobs:
8789
8890
- name: Create Release
8991
id: create_release
90-
uses: shogo82148/actions-create-release@v1
92+
uses: shogo82148/actions-create-release@e5f206451d4ace2da9916d01f1aef279997f8659 # v1
9193
with:
9294
tag_name: v${{ steps.version.outputs.release }}
9395
release_name: v${{ steps.version.outputs.release }}
@@ -112,6 +114,7 @@ jobs:
112114
publish-maven:
113115
runs-on: ubuntu-latest
114116
needs: [prepare-release]
117+
timeout-minutes: 60
115118
steps:
116119
- uses: actions/checkout@v4
117120

@@ -121,7 +124,7 @@ jobs:
121124
git config --global user.name "GitHub Actions"
122125
git pull
123126
124-
- name: Set up JDK Apache Maven Central
127+
- name: Set up JDK OSSRH
125128
uses: actions/setup-java@v4
126129
with: # running setup-java again overwrites the settings.xml
127130
java-version: '17'
@@ -132,7 +135,7 @@ jobs:
132135
gpg-passphrase: MAVEN_GPG_PASSPHRASE
133136
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
134137

135-
- name: Publish to Apache Maven Central
138+
- name: Publish to OSSRH
136139
run: ../mvnw -B deploy -Possrh -DskipTests
137140
env:
138141
MAVEN_CENTRAL_USERNAME: ${{ secrets.S01_OSS_SONATYPE_MAVEN_USERNAME }}
@@ -143,6 +146,7 @@ jobs:
143146
publish-pages:
144147
runs-on: ubuntu-latest
145148
needs: [prepare-release]
149+
timeout-minutes: 15
146150
steps:
147151
- uses: actions/checkout@v4
148152

@@ -160,18 +164,20 @@ jobs:
160164
cache: 'maven'
161165

162166
- name: Build site
163-
run: ../mvnw -B site -DskipTests
167+
run: ../mvnw -B compile site -DskipTests -T2C
164168
working-directory: ${{ env.PRIMARY_MAVEN_MODULE }}
165169

166170
- name: Deploy to Github pages
167-
uses: peaceiris/actions-gh-pages@v4
171+
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4
168172
with:
169173
github_token: ${{ secrets.GITHUB_TOKEN }}
170174
publish_dir: ./${{ env.PRIMARY_MAVEN_MODULE }}/target/site
175+
force_orphan: true
171176

172177
after-release:
173178
runs-on: ubuntu-latest
174179
needs: [publish-maven]
180+
timeout-minutes: 10
175181
steps:
176182
- uses: actions/checkout@v4
177183

@@ -185,7 +191,7 @@ jobs:
185191
run: |
186192
mvnwPath=$(readlink -f ./mvnw)
187193
modules=("") # root
188-
modules+=($(grep -ozP '(?<=module>)[^<]+' 'pom.xml' | tr -d '\0'))
194+
modules+=($(grep -oP '(?<=<module>)[^<]+' 'pom.xml'))
189195
for i in "${modules[@]}"
190196
do
191197
echo "Processing $i/pom.xml"

.github/workflows/sonar.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111
- '.idea/**'
1212
- 'assets/**'
1313
pull_request:
14-
types: [opened, synchronize, reopened]
14+
branches: [ develop ]
1515
paths-ignore:
1616
- '**.md'
1717
- '.config/**'
@@ -27,6 +27,7 @@ jobs:
2727
token-check:
2828
runs-on: ubuntu-latest
2929
if: ${{ !(github.event_name == 'pull_request' && startsWith(github.head_ref, 'renovate/')) }}
30+
timeout-minutes: 5
3031
outputs:
3132
hasToken: ${{ steps.check-token.outputs.has }}
3233
steps:
@@ -40,6 +41,7 @@ jobs:
4041
runs-on: ubuntu-latest
4142
needs: token-check
4243
if: ${{ needs.token-check.outputs.hasToken }}
44+
timeout-minutes: 30
4345
steps:
4446
- uses: actions/checkout@v4
4547
with:

.github/workflows/sync-labels.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@ permissions:
1414
jobs:
1515
labels:
1616
runs-on: ubuntu-latest
17+
timeout-minutes: 10
1718
steps:
1819
- uses: actions/checkout@v4
1920
with:
2021
sparse-checkout: .github/labels.yml
2122

22-
- uses: EndBug/label-sync@v2
23+
- uses: EndBug/label-sync@52074158190acb45f3077f9099fea818aa43f97a # v2
2324
with:
2425
config-file: .github/labels.yml

0 commit comments

Comments
 (0)