Skip to content

Commit 08fb9c2

Browse files
Introduce a gradle PMD plugin (#241)
1 parent 59b8749 commit 08fb9c2

File tree

5 files changed

+13
-31
lines changed

5 files changed

+13
-31
lines changed

.github/workflows/cicd.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,7 @@ jobs:
9696
run: |
9797
sudo apt-get update -y
9898
sudo apt-get install -y clang-format cppcheck
99-
curl -L -o pmd-bin-6.52.0.zip https://github.com/pmd/pmd/releases/download/pmd_releases%2F6.52.0/pmd-bin-6.52.0.zip
10099
curl -L -o spotbugs-4.7.3.zip https://github.com/spotbugs/spotbugs/releases/download/4.7.3/spotbugs-4.7.3.zip
101-
unzip pmd-bin-6.52.0.zip
102100
unzip spotbugs-4.7.3.zip
103101
104102
- name: Install opensource COBOL 4J
@@ -118,7 +116,8 @@ jobs:
118116
119117
- name: Run PMD
120118
run: |
121-
pmd-bin-6.52.0/bin/run.sh pmd -d ${PWD}/libcobj/src -R ${PWD}/.github/ruleset.xml -f text
119+
cd libcobj
120+
./gradlew pmdMain
122121
123122
- name: Run cppcheck
124123
run: |

CONTRIBUTING.md

+2-14
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,8 @@ The below sections describe how to setup and run static code analysis.
1414

1515
## Setup static analysis tools
1616

17-
### clang-format
18-
1917
Run `sudo apt install clang-format` in Ubuntu to install `clang-format`.
2018

21-
### PMD
22-
23-
Run the following commands to install `PMD`:
24-
```sh
25-
curl -L -o pmd-bin-6.52.0.zip https://github.com/pmd/pmd/releases/download/pmd_releases%2F6.52.0/pmd-bin-6.52.0.zip
26-
unzip pmd-bin-6.52.0.zip
27-
mv pmd-bin-6.52 /usr/local/bin/
28-
rm pmd-bin-6.52.0.zip
29-
```
30-
3119
## Run static analysis
3220

3321
### check with clang-format and google-java-format
@@ -37,7 +25,7 @@ If you want to make sure all files are formatted, run `./check-format` in the to
3725

3826
### PMD
3927

40-
Run the following command in the top directory of opensource COBOL 4J:
28+
Run the following command in libcobj/ directory:
4129
```
42-
/usr/local/bin/pmd-bin-6.52.0/bin/run.sh -d libcobj/src -R .github/ruleset.xml -f text
30+
./gradlew pmdMain
4331
```

CONTRIBUTING_JP.md

+2-14
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,8 @@ CIの静的解析はCとJavaのソースコードがそれぞれ[clang-format](h
1414

1515
## セットアップ
1616

17-
### clang-format
18-
1917
Ubuntuでは`sudo apt install clang-format`コマンドを実行すれば`clang-format`をインストールできます。
2018

21-
### PMD
22-
23-
下記のコマンドを実行して`PMD`をインストールしてください。
24-
```sh
25-
curl -L -o pmd-bin-6.52.0.zip https://github.com/pmd/pmd/releases/download/pmd_releases%2F6.52.0/pmd-bin-6.52.0.zip
26-
unzip pmd-bin-6.52.0.zip
27-
mv pmd-bin-6.52 /usr/local/bin/
28-
rm pmd-bin-6.52.0.zip
29-
```
30-
3119
## 静的解析の実行
3220

3321
### clang-formatとgoogle-java-format
@@ -37,7 +25,7 @@ opensource COBOL 4Jのトップディレクトリで`./format`を実行してく
3725

3826
### PMD
3927

40-
opensource COBOL 4Jのトップディレクトリで下記のコマンドを実行してください
28+
opensource COBOL 4Jのlibcobj/ディレクトリで下記のコマンドを実行してください
4129
```
42-
/usr/local/bin/pmd-bin-6.52.0/bin/run.sh -d libcobj/src -R .github/ruleset.xml -f text
30+
./gradlew pmdMain
4331
```

libcobj/app/build.gradle.kts

+7
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ plugins {
66
id("java")
77
id("com.github.sherter.google-java-format") version "0.9"
88
id("maven-publish")
9+
pmd
910
}
1011

1112
repositories {
@@ -24,6 +25,12 @@ java {
2425
}
2526
}
2627

28+
pmd {
29+
isConsoleOutput = true
30+
ruleSets = listOf()
31+
ruleSetFiles = files("${rootDir}/config/pmdRuleSet.xml")
32+
}
33+
2734
publishing {
2835
repositories {
2936
maven {
File renamed without changes.

0 commit comments

Comments
 (0)