Skip to content

Commit 95af404

Browse files
committed
Introduce pmd
1 parent 08f4a3e commit 95af404

File tree

2 files changed

+39
-1
lines changed

2 files changed

+39
-1
lines changed

.github/workflows/check-build.yml

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,9 @@ jobs:
7373
path: build/libs/template-placeholder-*.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:
@@ -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: [17]
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

build.gradle

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ plugins {
22
id 'java'
33
id 'idea'
44
id 'checkstyle'
5+
id 'pmd'
56
id 'org.jetbrains.intellij' version '1.17.4'
67
id 'org.sonarqube' version '5.0.0.4638'
78
}
@@ -78,6 +79,11 @@ checkstyle {
7879
toolVersion = checkstyleVersion
7980
}
8081

82+
pmd {
83+
consoleOutput = true
84+
ruleSetFiles = files(".config/pmd/ruleset.xml")
85+
}
86+
8187
tasks.withType(Checkstyle).configureEach {
8288
enabled = project.hasProperty("checkstyleEnabled");
8389
}

0 commit comments

Comments
 (0)