Skip to content

Commit cb9e074

Browse files
authored
Merge pull request #48 from xdev-software/develop
Release
2 parents b1a27c3 + a25ddbe commit cb9e074

25 files changed

Lines changed: 291 additions & 210 deletions

.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>
Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525

2626
strategy:
2727
matrix:
28-
java: [17, 21]
28+
java: [21]
2929
distribution: [temurin]
3030

3131
steps:
@@ -73,12 +73,13 @@ jobs:
7373
path: build/libs/intellij-plugin-openrewriter-*.jar
7474
if-no-files-found: error
7575

76-
code-style:
76+
checkstyle:
7777
runs-on: ubuntu-latest
78+
if: ${{ github.event_name != 'pull_request' || !startsWith(github.head_ref, 'renovate/') }}
7879

7980
strategy:
8081
matrix:
81-
java: [17]
82+
java: [21]
8283
distribution: [temurin]
8384

8485
steps:
@@ -93,3 +94,34 @@ jobs:
9394

9495
- name: Run Checkstyle
9596
run: ./gradlew checkstyleMain checkstyleTest -PcheckstyleEnabled=true
97+
98+
pmd:
99+
runs-on: ubuntu-latest
100+
if: ${{ github.event_name != 'pull_request' || !startsWith(github.head_ref, 'renovate/') }}
101+
102+
strategy:
103+
matrix:
104+
java: [21]
105+
distribution: [temurin]
106+
107+
steps:
108+
- uses: actions/checkout@v4
109+
110+
- name: Set up JDK
111+
uses: actions/setup-java@v4
112+
with:
113+
distribution: ${{ matrix.distribution }}
114+
java-version: ${{ matrix.java }}
115+
cache: 'gradle'
116+
117+
- name: Run PMD
118+
run: ./gradlew pmdMain pmdTest
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+
build/reports/pmd/*.html

.github/workflows/checkIDECompatibility.yml

Lines changed: 0 additions & 54 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- name: Set up JDK
1818
uses: actions/setup-java@v4
1919
with:
20-
java-version: '17'
20+
java-version: '21'
2121
distribution: 'temurin'
2222
cache: 'gradle'
2323

@@ -106,7 +106,7 @@ jobs:
106106
uses: actions/setup-java@v4
107107
with:
108108
distribution: 'temurin'
109-
java-version: 17
109+
java-version: 21
110110
cache: 'gradle'
111111

112112
- name: Init Git and pull

.github/workflows/sonar.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
uses: actions/setup-java@v4
5050
with:
5151
distribution: 'temurin'
52-
java-version: 17
52+
java-version: 21
5353

5454
- name: Cache SonarCloud packages
5555
uses: actions/cache@v4

.github/workflows/test-deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
uses: actions/setup-java@v4
1414
with:
1515
distribution: 'temurin'
16-
java-version: 17
16+
java-version: 21
1717
cache: 'gradle'
1818

1919
- name: Update/Generify version

.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: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ classes
1313

1414
# Plugins
1515
*.idea/checkstyle-idea.xml
16+
.intellijPlatform
1617

1718
# Gradle
1819
.gradle/

.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.

.run/Run Tests.run.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<option name="executionName" />
66
<option name="externalProjectPath" value="$PROJECT_DIR$" />
77
<option name="externalSystemIdString" value="GRADLE" />
8-
<option name="scriptParameters" value="" />
8+
<option name="scriptParameters" value="-PskipPMD" />
99
<option name="taskDescriptions">
1010
<list />
1111
</option>
@@ -19,6 +19,7 @@
1919
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
2020
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
2121
<DebugAllEnabled>false</DebugAllEnabled>
22+
<RunAsTest>false</RunAsTest>
2223
<method v="2" />
2324
</configuration>
24-
</component>
25+
</component>

0 commit comments

Comments
 (0)