Setup Composer dependency analyser

This commit is contained in:
Yassine Guedidi 2024-03-30 00:38:37 +01:00
parent 43fae01790
commit dc4347b2a3
4 changed files with 145 additions and 1 deletions

View file

@ -41,6 +41,9 @@ jobs:
with:
composer-options: "--optimize-autoloader --prefer-dist"
- name: "Run Composer dependency analyser"
run: "bin/composer-dependency-analyser"
- name: "Run PHP CS Fixer"
run: "bin/php-cs-fixer fix --verbose --dry-run --format=checkstyle | cs2pr"

View file

@ -0,0 +1,77 @@
<?php
use ShipMonk\ComposerDependencyAnalyser\Config\Configuration;
use ShipMonk\ComposerDependencyAnalyser\Config\ErrorType;
$config = new Configuration();
return $config
->disableComposerAutoloadPathScan()
->enableAnalysisOfUnusedDevDependencies()
->addPathToScan(__DIR__ . '/app', false)
->addPathToScan(__DIR__ . '/migrations', false)
->addPathToScan(__DIR__ . '/src', false)
->addPathToScan(__DIR__ . '/web', false)
->addPathToScan(__DIR__ . '/tests', true)
->ignoreErrorsOnPackages([
'babdev/pagerfanta-bundle',
'doctrine/common',
'doctrine/doctrine-migrations-bundle',
'egulias/email-validator',
'ergebnis/composer-normalize',
'friendsofphp/php-cs-fixer',
'friendsofsymfony/jsrouting-bundle',
'friendsoftwig/twigcs',
'incenteev/composer-parameter-handler',
'jms/serializer-bundle',
'laminas/laminas-code',
'lcobucci/jwt',
'mgargano/simplehtmldom',
'mnapoli/piwik-twig-extension',
'nelmio/api-doc-bundle',
'nelmio/cors-bundle',
'ocramius/proxy-manager',
'pagerfanta/twig',
'php-http/client-common',
'php-http/httplug',
'php-http/mock-client',
'phpstan/extension-installer',
'phpstan/phpstan',
'phpstan/phpstan-doctrine',
'phpstan/phpstan-phpunit',
'phpstan/phpstan-symfony',
'psr/http-client',
'psr/http-factory',
'psr/http-message',
'rulerz-php/doctrine-orm',
'scheb/2fa-bundle',
'scheb/2fa-qr-code',
'scheb/2fa-trusted-device',
'sentry/sentry-symfony',
'shipmonk/composer-dependency-analyser',
'stof/doctrine-extensions-bundle',
'symfony/asset',
'symfony/browser-kit',
'symfony/css-selector',
'symfony/debug-bundle',
'symfony/doctrine-bridge',
'symfony/google-mailer',
'symfony/intl',
'symfony/maker-bundle',
'symfony/monolog-bundle',
'symfony/phpunit-bridge',
'symfony/polyfill-php80',
'symfony/polyfill-php81',
'symfony/proxy-manager-bridge',
'symfony/security-bundle',
'symfony/templating',
'symfony/twig-bundle',
'symfony/var-dumper',
'symfony/web-profiler-bundle',
'symfony/web-server-bundle',
'twig/extra-bundle',
'twig/string-extra',
'wallabag/rulerz-bundle',
'willdurand/hateoas-bundle',
], [ErrorType::UNUSED_DEPENDENCY])
;

View file

@ -174,6 +174,7 @@
"phpstan/phpstan-phpunit": "^1.3.16",
"phpstan/phpstan-symfony": "^1.3.7",
"phpunit/phpunit": "^9.6.17",
"shipmonk/composer-dependency-analyser": "^1.4",
"symfony/browser-kit": "^5.4.35",
"symfony/css-selector": "^5.4.35",
"symfony/debug-bundle": "^5.4.35",

65
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "0faa53277c2598ea8aa924a63db88580",
"content-hash": "7af2ea826ebb45b5d2249424c58d14eb",
"packages": [
{
"name": "babdev/pagerfanta-bundle",
@ -18756,6 +18756,69 @@
],
"time": "2020-09-28T06:39:44+00:00"
},
{
"name": "shipmonk/composer-dependency-analyser",
"version": "1.4.0",
"source": {
"type": "git",
"url": "https://github.com/shipmonk-rnd/composer-dependency-analyser.git",
"reference": "da787b1ec7e02e618f080e65f944a72a47a4696c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/shipmonk-rnd/composer-dependency-analyser/zipball/da787b1ec7e02e618f080e65f944a72a47a4696c",
"reference": "da787b1ec7e02e618f080e65f944a72a47a4696c",
"shasum": ""
},
"require": {
"ext-json": "*",
"ext-tokenizer": "*",
"php": "^7.2 || ^8.0"
},
"require-dev": {
"editorconfig-checker/editorconfig-checker": "^10.3.0",
"ergebnis/composer-normalize": "^2.19",
"phpstan/phpstan": "^1.10.63",
"phpstan/phpstan-phpunit": "^1.1.1",
"phpstan/phpstan-strict-rules": "^1.2.3",
"phpunit/phpunit": "^8.5.28 || ^9.5.20",
"shipmonk/name-collision-detector": "^2.0.0",
"slevomat/coding-standard": "^8.0.1"
},
"bin": [
"bin/composer-dependency-analyser"
],
"type": "library",
"autoload": {
"psr-4": {
"ShipMonk\\ComposerDependencyAnalyser\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "Fast detection of composer dependency issues (dead dependencies, shadow dependencies, misplaced dependencies)",
"keywords": [
"analyser",
"composer",
"composer dependency",
"dead code",
"dead dependency",
"detector",
"dev",
"misplaced dependency",
"shadow dependency",
"static analysis",
"unused code",
"unused dependency"
],
"support": {
"issues": "https://github.com/shipmonk-rnd/composer-dependency-analyser/issues",
"source": "https://github.com/shipmonk-rnd/composer-dependency-analyser/tree/1.4.0"
},
"time": "2024-03-19T15:39:35+00:00"
},
{
"name": "symfony/browser-kit",
"version": "v5.4.35",