diff --git a/.codeclimate.yml b/.codeclimate.yml index caa9009..25d8ed0 100644 --- a/.codeclimate.yml +++ b/.codeclimate.yml @@ -1,21 +1,21 @@ version: "2" checks: argument-count: - enabled: true + enabled: false complex-logic: - enabled: true + enabled: false file-lines: enabled: false method-complexity: - enabled: true + enabled: false method-count: - enabled: true + enabled: false method-lines: - enabled: true + enabled: false nested-control-flow: enabled: true return-statements: - enabled: true + enabled: false similar-code: enabled: false identical-code: diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index c4e312a..e8746be 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -59,7 +59,6 @@ jobs: skip-phpcs: false skip-phpstan: false skip-rector: false - skip-phpmd: false skip-eslint: true skip-stylelint: true skip-prettier: true diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php index aba2c98..5ac7ea1 100644 --- a/.php-cs-fixer.php +++ b/.php-cs-fixer.php @@ -11,10 +11,12 @@ declare(strict_types = 1); -$header = <<<'EOF' +$year = date('Y'); + +$header = << + Copyright (c) 2019-{$year}, Thomas Mueller For the full copyright and license information, please view the LICENSE file that was distributed with this source code. @@ -26,6 +28,7 @@ ->in(__DIR__ . '/src') ->in(__DIR__ . '/tests') ->append([__DIR__ . '/rector.php']) + ->append([__DIR__ . '/composer-dependency-analyser.php']) ->append([__FILE__]); $rules = require 'vendor/mimmi20/coding-standard/src/php-cs-fixer.config.php'; diff --git a/codecov.yml b/codecov.yml index 65d180e..9c924a4 100644 --- a/codecov.yml +++ b/codecov.yml @@ -2,12 +2,16 @@ codecov: require_ci_to_pass: false notify: wait_for_ci: false + +coverage: status: project: - default: + default: # default is the status check's name, not default settings target: 100% threshold: 1% + if_ci_failed: success #success, failure, error, ignore informational: true + only_pulls: false patch: default: informational: true diff --git a/composer-dependency-analyser.php b/composer-dependency-analyser.php new file mode 100644 index 0000000..1204f6c --- /dev/null +++ b/composer-dependency-analyser.php @@ -0,0 +1,45 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types = 1); + +use ShipMonk\ComposerDependencyAnalyser\Config\Configuration; +use ShipMonk\ComposerDependencyAnalyser\Config\ErrorType; + +$config = new Configuration(); + +$config + // Adjusting scanned paths + ->addPathToScan(__DIR__ . '/src', isDev: false) + ->addPathToScan(__DIR__ . '/tests', isDev: true) + ->addPathToScan(__DIR__ . '/vendor', isDev: false) + ->addPathToExclude(__DIR__ . '/vendor/rector/rector') + ->addPathToExclude(__DIR__ . '/vendor/phpstan/phpstan') + // applies only to directory scanning, not directly listed files + ->setFileExtensions(['php']) + + // Ignoring errors in vendor directory + ->ignoreErrorsOnPath(__DIR__ . '/vendor', [ErrorType::SHADOW_DEPENDENCY]) + ->ignoreErrorsOnPath(__DIR__ . '/vendor', [ErrorType::UNKNOWN_FUNCTION]) + ->ignoreErrorsOnPath(__DIR__ . '/vendor', [ErrorType::UNKNOWN_CLASS]) + ->ignoreErrorsOnPath(__DIR__ . '/vendor', [ErrorType::DEV_DEPENDENCY_IN_PROD]) + + // do not complain about some modules + ->ignoreErrorsOnPackage('mimmi20/coding-standard', [ErrorType::UNUSED_DEPENDENCY]) + ->ignoreErrorsOnPackage('phpstan/extension-installer', [ErrorType::UNUSED_DEPENDENCY]) + ->ignoreErrorsOnPackage('phpstan/phpstan-phpunit', [ErrorType::UNUSED_DEPENDENCY]) + ->ignoreErrorsOnPackage('phpstan/phpstan-deprecation-rules', [ErrorType::UNUSED_DEPENDENCY]) + + // Adjust analysis + // dev packages are often used only in CI, so this is not enabled by default + ->enableAnalysisOfUnusedDevDependencies(); + +return $config; diff --git a/composer.json b/composer.json index f6994aa..4ac9f6b 100644 --- a/composer.json +++ b/composer.json @@ -25,6 +25,7 @@ "require-dev": { "ext-ctype": "*", "ext-dom": "*", + "ext-mbstring": "*", "ext-simplexml": "*", "ext-tokenizer": "*", "ext-xml": "*", @@ -39,6 +40,7 @@ "phpunit/phpunit": "^11.5.2", "rector/rector": "^1.2.10", "rector/type-perfect": "^1.0.0", + "shipmonk/composer-dependency-analyser": "^1.8.1", "symfony/process": "^7.2.0", "symplify/phpstan-rules": "^13.0.1", "tomasvotruba/cognitive-complexity": "^0.2.3", diff --git a/phpcs.xml b/phpcs.xml index 3b1773d..112c7f2 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -18,4 +18,5 @@ tests .php-cs-fixer.php rector.php + composer-dependency-analyser.php diff --git a/phpmd.ruleset.xml b/phpmd.ruleset.xml deleted file mode 100644 index 15d9ade..0000000 --- a/phpmd.ruleset.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - The coding standard. - - - - - - - - - - - - - - - - - - - - - - - - - - - - -