From c680273be1336f0674306a49514d4ca9007f1b37 Mon Sep 17 00:00:00 2001 From: Rene Schmidt Date: Mon, 23 Dec 2024 21:35:00 +0100 Subject: [PATCH] feature: integrated phpmd and baseline --- .forgejo/workflows/tests.yml | 3 +++ .github/workflows/tests.yml | 3 +++ .gitignore | 3 ++- composer.json | 5 +++- phpmd.baseline.xml | 46 +++++++++++++++++++++++++++++++++ phpmd.xml | 50 ++++++++++++++++++++++++++++++++++++ 6 files changed, 108 insertions(+), 2 deletions(-) create mode 100644 phpmd.baseline.xml create mode 100644 phpmd.xml diff --git a/.forgejo/workflows/tests.yml b/.forgejo/workflows/tests.yml index 46fa464..39b0f66 100644 --- a/.forgejo/workflows/tests.yml +++ b/.forgejo/workflows/tests.yml @@ -32,6 +32,9 @@ jobs: - name: Prepare tests run: composer run-script tests_prepare + - name: Run PHPMD + run: composer run phpmd + - name: Run Rector run: composer run rector diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1d072a4..9310f79 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -35,6 +35,9 @@ jobs: - name: Run Rector run: composer run rector + - name: Run PHPMD + run: composer run phpmd + - name: Run PHPStan run: composer run phpstan diff --git a/.gitignore b/.gitignore index f365a19..fd7178c 100644 --- a/.gitignore +++ b/.gitignore @@ -40,4 +40,5 @@ vendor/ .env bin/run_tests_*.sh internal_requests/ -.phpunit.result.cache \ No newline at end of file +.phpunit.result.cache +.phpmd.result-cache.php \ No newline at end of file diff --git a/composer.json b/composer.json index 994081c..12f63df 100644 --- a/composer.json +++ b/composer.json @@ -34,7 +34,8 @@ "phpunit/php-timer": "~5.0", "fzaninotto/faker": "~1.5", "phpstan/phpstan": "^1.11", - "rector/rector": "^1.2" + "rector/rector": "^1.2", + "phpmd/phpmd": "^2.15.0" }, "type": "library", "autoload": { @@ -49,6 +50,8 @@ } }, "scripts": { + "create-phpmd-baseline": "./vendor/bin/phpmd -v --cache . text phpmd.xml --generate-baseline", + "phpmd": "./vendor/bin/phpmd -v --cache . text phpmd.xml", "phpstan": "./vendor/bin/phpstan analyse --memory-limit 2G --configuration phpstan.neon src test", "phpunit": "./vendor/bin/phpunit --log-junit ./build/logs/junit.xml test", "rector": "./vendor/bin/rector --dry-run --no-ansi --no-progress-bar", diff --git a/phpmd.baseline.xml b/phpmd.baseline.xml new file mode 100644 index 0000000..1276d0b --- /dev/null +++ b/phpmd.baseline.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/phpmd.xml b/phpmd.xml new file mode 100644 index 0000000..d7b0e41 --- /dev/null +++ b/phpmd.xml @@ -0,0 +1,50 @@ + + + My PHPMD ruleset + + */vendor/ + + */src/ + */test/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file