Merge pull request #7392 from yguedidi/setup-composer-dependency-analyser

Setup Composer dependency analyser
This commit is contained in:
Yassine Guedidi 2024-03-30 13:13:40 +01:00 committed by GitHub
commit 656ff1b03b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 169 additions and 11 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

@ -6,6 +6,6 @@ services:
# fixtures
Wallabag\DataFixtures\:
resource: '../../src/DataFixtures/*'
resource: '../../fixtures/*'
tags: ['doctrine.fixture.orm']
autowire: true

View file

@ -0,0 +1,84 @@
<?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__ . '/fixtures', true)
->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])
->ignoreErrorsOnPackages([
'guzzlehttp/streams',
'monolog/monolog',
'symfony/filesystem',
'symfony/http-client',
], [ErrorType::PROD_DEPENDENCY_ONLY_IN_DEV])
;

View file

@ -77,6 +77,7 @@
"friendsofsymfony/user-bundle": "^3.2.1",
"guzzlehttp/guzzle": "^5.3.4",
"guzzlehttp/psr7": "^2.6.2",
"guzzlehttp/streams": "^3.0",
"html2text/html2text": "^4.3.1",
"incenteev/composer-parameter-handler": "^2.2",
"j0k3r/graby": "^2.4.5",
@ -87,6 +88,7 @@
"lcobucci/jwt": "^4.3",
"mgargano/simplehtmldom": "^1.5",
"mnapoli/piwik-twig-extension": "^3.0",
"monolog/monolog": "^2.9",
"nelmio/api-doc-bundle": "^4.20.0",
"nelmio/cors-bundle": "^2.4",
"ocramius/proxy-manager": "^2.1.1",
@ -127,11 +129,13 @@
"symfony/event-dispatcher": "^5.4.35",
"symfony/event-dispatcher-contracts": "^2.5.2",
"symfony/expression-language": "^5.4.35",
"symfony/filesystem": "^5.4",
"symfony/finder": "^5.4.35",
"symfony/form": "^5.4.35",
"symfony/framework-bundle": "^5.4.35",
"symfony/google-mailer": "^5.4.35",
"symfony/http-client": "^5.4.35",
"symfony/http-client-contracts": "^2.5",
"symfony/http-foundation": "^5.4.35",
"symfony/http-kernel": "^5.4.35",
"symfony/intl": "^5.4.35",
@ -162,6 +166,7 @@
},
"require-dev": {
"dama/doctrine-test-bundle": "^8.0.2",
"doctrine/data-fixtures": "^1.7",
"doctrine/doctrine-fixtures-bundle": "^3.5.1",
"ergebnis/composer-normalize": "^2.42.0",
"friendsofphp/php-cs-fixer": "^3.49",
@ -174,11 +179,13 @@
"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",
"symfony/maker-bundle": "^1.43",
"symfony/phpunit-bridge": "^7.0.3",
"symfony/process": "^5.4",
"symfony/var-dumper": "^5.4.35",
"symfony/web-profiler-bundle": "^5.4.35",
"symfony/web-server-bundle": "^4.4.44"
@ -199,7 +206,8 @@
},
"autoload-dev": {
"psr-4": {
"Tests\\Wallabag\\": "tests/"
"Tests\\Wallabag\\": "tests/",
"Wallabag\\DataFixtures\\": "fixtures/"
},
"files": [
"tests/functions.php"

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": "0a74a67de64eb6e87c0da79076fefb64",
"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",

View file

@ -2,11 +2,11 @@
namespace Application\Migrations;
use Doctrine\DBAL\Migrations\SkipMigrationException;
use Doctrine\DBAL\Platforms\MySQLPlatform;
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
use Doctrine\DBAL\Platforms\SqlitePlatform;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\Exception\SkipMigration;
use Wallabag\Doctrine\WallabagMigration;
/**
@ -102,6 +102,6 @@ class Version20161001072726 extends WallabagMigration
public function down(Schema $schema): void
{
throw new SkipMigrationException('Too complex ...');
throw new SkipMigration('Too complex ...');
}
}

View file

@ -2,11 +2,11 @@
namespace Application\Migrations;
use Doctrine\DBAL\Migrations\SkipMigrationException;
use Doctrine\DBAL\Platforms\MySQLPlatform;
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
use Doctrine\DBAL\Platforms\SqlitePlatform;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\Exception\SkipMigration;
use Wallabag\Doctrine\WallabagMigration;
/**
@ -75,7 +75,7 @@ EOD
switch (true) {
case $platform instanceof SqlitePlatform:
throw new SkipMigrationException('Too complex ...');
throw new SkipMigration('Too complex ...');
break;
case $platform instanceof MySQLPlatform:
$this->addSql('ALTER TABLE ' . $tableName . ' MODIFY quote VARCHAR(255) NOT NULL');

View file

@ -2,11 +2,11 @@
namespace Application\Migrations;
use Doctrine\DBAL\Migrations\SkipMigrationException;
use Doctrine\DBAL\Platforms\MySQLPlatform;
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
use Doctrine\DBAL\Platforms\SqlitePlatform;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\Exception\SkipMigration;
use Wallabag\Doctrine\WallabagMigration;
/**
@ -98,6 +98,6 @@ final class Version20190510141130 extends WallabagMigration
public function down(Schema $schema): void
{
throw new SkipMigrationException('Too complex ...');
throw new SkipMigration('Too complex ...');
}
}

View file

@ -2,8 +2,8 @@
namespace Application\Migrations;
use Doctrine\DBAL\Migrations\SkipMigrationException;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\Exception\SkipMigration;
use Wallabag\Doctrine\WallabagMigration;
/**
@ -18,6 +18,6 @@ final class Version20200414120227 extends WallabagMigration
public function down(Schema $schema): void
{
throw new SkipMigrationException('Not possible ... ');
throw new SkipMigration('Not possible ... ');
}
}