diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index c6e8f0af..02652382 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -96,9 +96,7 @@ jobs: run: | sudo apt-get update -y sudo apt-get install -y clang-format cppcheck - 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 curl -L -o spotbugs-4.7.3.zip https://github.com/spotbugs/spotbugs/releases/download/4.7.3/spotbugs-4.7.3.zip - unzip pmd-bin-6.52.0.zip unzip spotbugs-4.7.3.zip - name: Install opensource COBOL 4J @@ -118,7 +116,8 @@ jobs: - name: Run PMD run: | - pmd-bin-6.52.0/bin/run.sh pmd -d ${PWD}/libcobj/src -R ${PWD}/.github/ruleset.xml -f text + cd libcobj + ./gradlew pmdMain - name: Run cppcheck run: | diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3af22447..bf552d4a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -14,20 +14,8 @@ The below sections describe how to setup and run static code analysis. ## Setup static analysis tools -### clang-format - Run `sudo apt install clang-format` in Ubuntu to install `clang-format`. -### PMD - -Run the following commands to install `PMD`: -```sh -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 -unzip pmd-bin-6.52.0.zip -mv pmd-bin-6.52 /usr/local/bin/ -rm pmd-bin-6.52.0.zip -``` - ## Run static analysis ### 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 ### PMD -Run the following command in the top directory of opensource COBOL 4J: +Run the following command in libcobj/ directory: ``` -/usr/local/bin/pmd-bin-6.52.0/bin/run.sh -d libcobj/src -R .github/ruleset.xml -f text +./gradlew pmdMain ``` diff --git a/CONTRIBUTING_JP.md b/CONTRIBUTING_JP.md index 854eb5ec..a191d350 100644 --- a/CONTRIBUTING_JP.md +++ b/CONTRIBUTING_JP.md @@ -14,20 +14,8 @@ CIの静的解析はCとJavaのソースコードがそれぞれ[clang-format](h ## セットアップ -### clang-format - Ubuntuでは`sudo apt install clang-format`コマンドを実行すれば`clang-format`をインストールできます。 -### PMD - -下記のコマンドを実行して`PMD`をインストールしてください。 -```sh -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 -unzip pmd-bin-6.52.0.zip -mv pmd-bin-6.52 /usr/local/bin/ -rm pmd-bin-6.52.0.zip -``` - ## 静的解析の実行 ### clang-formatとgoogle-java-format @@ -37,7 +25,7 @@ opensource COBOL 4Jのトップディレクトリで`./format`を実行してく ### PMD -opensource COBOL 4Jのトップディレクトリで下記のコマンドを実行してください。 +opensource COBOL 4Jのlibcobj/ディレクトリで下記のコマンドを実行してください。 ``` -/usr/local/bin/pmd-bin-6.52.0/bin/run.sh -d libcobj/src -R .github/ruleset.xml -f text +./gradlew pmdMain ``` diff --git a/libcobj/app/build.gradle.kts b/libcobj/app/build.gradle.kts index 5ef0082c..997ef91e 100644 --- a/libcobj/app/build.gradle.kts +++ b/libcobj/app/build.gradle.kts @@ -6,6 +6,7 @@ plugins { id("java") id("com.github.sherter.google-java-format") version "0.9" id("maven-publish") + pmd } repositories { @@ -24,6 +25,12 @@ java { } } +pmd { + isConsoleOutput = true + ruleSets = listOf() + ruleSetFiles = files("${rootDir}/config/pmdRuleSet.xml") +} + publishing { repositories { maven { diff --git a/.github/ruleset.xml b/libcobj/config/pmdRuleSet.xml similarity index 100% rename from .github/ruleset.xml rename to libcobj/config/pmdRuleSet.xml