diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index 5bf4bd840..9b8b6b0fb 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -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" diff --git a/app/config/services_test.yml b/app/config/services_test.yml index 9d894bb57..c850bf215 100644 --- a/app/config/services_test.yml +++ b/app/config/services_test.yml @@ -6,6 +6,6 @@ services: # fixtures Wallabag\DataFixtures\: - resource: '../../src/DataFixtures/*' + resource: '../../fixtures/*' tags: ['doctrine.fixture.orm'] autowire: true diff --git a/composer-dependency-analyser.php b/composer-dependency-analyser.php new file mode 100644 index 000000000..a3c379a2c --- /dev/null +++ b/composer-dependency-analyser.php @@ -0,0 +1,84 @@ +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]) +; diff --git a/composer.json b/composer.json index 7a1dcc773..daab0c8ce 100644 --- a/composer.json +++ b/composer.json @@ -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" diff --git a/composer.lock b/composer.lock index 098dfddd5..9db284851 100644 --- a/composer.lock +++ b/composer.lock @@ -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", diff --git a/src/DataFixtures/AnnotationFixtures.php b/fixtures/AnnotationFixtures.php similarity index 100% rename from src/DataFixtures/AnnotationFixtures.php rename to fixtures/AnnotationFixtures.php diff --git a/src/DataFixtures/ConfigFixtures.php b/fixtures/ConfigFixtures.php similarity index 100% rename from src/DataFixtures/ConfigFixtures.php rename to fixtures/ConfigFixtures.php diff --git a/src/DataFixtures/EntryFixtures.php b/fixtures/EntryFixtures.php similarity index 100% rename from src/DataFixtures/EntryFixtures.php rename to fixtures/EntryFixtures.php diff --git a/src/DataFixtures/IgnoreOriginInstanceRuleFixtures.php b/fixtures/IgnoreOriginInstanceRuleFixtures.php similarity index 100% rename from src/DataFixtures/IgnoreOriginInstanceRuleFixtures.php rename to fixtures/IgnoreOriginInstanceRuleFixtures.php diff --git a/src/DataFixtures/IgnoreOriginUserRuleFixtures.php b/fixtures/IgnoreOriginUserRuleFixtures.php similarity index 100% rename from src/DataFixtures/IgnoreOriginUserRuleFixtures.php rename to fixtures/IgnoreOriginUserRuleFixtures.php diff --git a/src/DataFixtures/InternalSettingFixtures.php b/fixtures/InternalSettingFixtures.php similarity index 100% rename from src/DataFixtures/InternalSettingFixtures.php rename to fixtures/InternalSettingFixtures.php diff --git a/src/DataFixtures/SiteCredentialFixtures.php b/fixtures/SiteCredentialFixtures.php similarity index 100% rename from src/DataFixtures/SiteCredentialFixtures.php rename to fixtures/SiteCredentialFixtures.php diff --git a/src/DataFixtures/TagFixtures.php b/fixtures/TagFixtures.php similarity index 100% rename from src/DataFixtures/TagFixtures.php rename to fixtures/TagFixtures.php diff --git a/src/DataFixtures/TaggingRuleFixtures.php b/fixtures/TaggingRuleFixtures.php similarity index 100% rename from src/DataFixtures/TaggingRuleFixtures.php rename to fixtures/TaggingRuleFixtures.php diff --git a/src/DataFixtures/UserFixtures.php b/fixtures/UserFixtures.php similarity index 100% rename from src/DataFixtures/UserFixtures.php rename to fixtures/UserFixtures.php diff --git a/migrations/Version20161001072726.php b/migrations/Version20161001072726.php index b8870fbc0..c90604bb3 100644 --- a/migrations/Version20161001072726.php +++ b/migrations/Version20161001072726.php @@ -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 ...'); } } diff --git a/migrations/Version20170511211659.php b/migrations/Version20170511211659.php index 8c93bc96e..b3b3c41f9 100644 --- a/migrations/Version20170511211659.php +++ b/migrations/Version20170511211659.php @@ -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'); diff --git a/migrations/Version20190510141130.php b/migrations/Version20190510141130.php index 9ac23b77a..390e4afe6 100644 --- a/migrations/Version20190510141130.php +++ b/migrations/Version20190510141130.php @@ -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 ...'); } } diff --git a/migrations/Version20200414120227.php b/migrations/Version20200414120227.php index e84d8d322..fa61b2a40 100644 --- a/migrations/Version20200414120227.php +++ b/migrations/Version20200414120227.php @@ -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 ... '); } }