Skip to content

Commit

Permalink
Replace composer-unused & composer-require-checker with composer-depe…
Browse files Browse the repository at this point in the history
…ndency-analyser (#81)

* Replace composer-unused & composer-require-checker with composer-dependency-analyser

* Add to CI
  • Loading branch information
janedbal authored Jan 12, 2024
1 parent a2291ef commit b393b99
Show file tree
Hide file tree
Showing 5 changed files with 537 additions and 457 deletions.
14 changes: 0 additions & 14 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,10 @@ jobs:
name: Install dependencies
run: composer install --no-progress --prefer-dist --no-interaction

-
name: Install extra tools
run: |
wget -q https://github.com/composer-unused/composer-unused/releases/latest/download/composer-unused.phar
wget -q https://github.com/maglnet/ComposerRequireChecker/releases/download/4.5.0/composer-require-checker.phar
-
name: Run checks
run: composer check

-
name: Check unused dependencies
run: php composer-unused.phar --output-format=default

-
name: Check shadow dependencies
run: php composer-require-checker.phar check composer.json


tests:
runs-on: ubuntu-latest
Expand Down
21 changes: 21 additions & 0 deletions composer-dependency-analyser.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php declare(strict_types = 1);

use ShipMonk\ComposerDependencyAnalyser\Config\Configuration;
use ShipMonk\ComposerDependencyAnalyser\Config\ErrorType;

$config = new Configuration();

$ciTools = [
'editorconfig-checker/editorconfig-checker',
'ergebnis/composer-normalize',
'phpstan/phpstan',
'phpstan/phpstan-phpunit',
'phpstan/phpstan-strict-rules',
'shipmonk/composer-dependency-analyser',
'shipmonk/phpstan-rules',
'slevomat/coding-standard',
];

return $config
->enableAnalysisOfUnusedDevDependencies()
->ignoreErrorsOnPackages($ciTools, [ErrorType::UNUSED_DEPENDENCY]);
11 changes: 10 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,16 @@
},
"require-dev": {
"doctrine/annotations": "^2.0",
"doctrine/collections": "^1.8 || ^2.1",
"doctrine/dbal": "^2.17 || ^3.7",
"doctrine/event-manager": "^1.2 || ^2.0",
"editorconfig-checker/editorconfig-checker": "^10.3.0",
"ergebnis/composer-normalize": "^2.28",
"phpstan/phpstan": "^1.9.14",
"phpstan/phpstan-phpunit": "^1.3.3",
"phpstan/phpstan-strict-rules": "^1.4.5",
"phpunit/phpunit": "^9.5.28",
"shipmonk/composer-dependency-analyser": "dev-master",
"shipmonk/phpstan-rules": "^2.2.0",
"slevomat/coding-standard": "^8.8.0"
},
Expand Down Expand Up @@ -44,10 +48,15 @@
"@check:ec",
"@check:cs",
"@check:types",
"@check:tests"
"@check:tests",
"@check:dependencies"
],
"check:composer": "composer normalize --dry-run --no-check-lock --no-update-lock",
"check:cs": "phpcs",
"check:dependencies": [
"composer dump-autoload --classmap-authoritative",
"composer-dependency-analyser"
],
"check:ec": "ec src tests",
"check:tests": "phpunit -vvv tests",
"check:types": "phpstan analyse -vvv",
Expand Down
Loading

0 comments on commit b393b99

Please sign in to comment.