Skip to content

Commit

Permalink
replace Composer Require Checker with more capable Composer Dependenc…
Browse files Browse the repository at this point in the history
…y Analyser
  • Loading branch information
VasekPurchart committed Dec 4, 2024
2 parents 8c10e79 + 3d48f06 commit 370095e
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 12 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ jobs:
name: 'Check coding standard'
run: 'bin/phing create-dirs cs || cat build/log/phpcs-checkstyle.xml | cs2pr'

composer-require-checker:
name: 'Composer require check'
composer-dependencies:
name: 'Composer dependencies'
needs: 'lint'
runs-on: 'ubuntu-latest'

Expand All @@ -123,8 +123,8 @@ jobs:
with:
dependency-versions: 'highest'
-
name: 'Check missing Composer requires'
run: 'bin/phing composer-require-checker'
name: 'Analyze Composer dependencies'
run: 'bin/phing composer-dependencies'

tests:
name: 'Tests - PHP ${{ matrix.php-version }}, ${{ matrix.composer-dependencies }} dependencies'
Expand Down
14 changes: 9 additions & 5 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
<property name="path.bin" value="${path.root}/bin"/>
<property name="path.build.log" value="${path.build}/log"/>
<property name="path.composer.executable" value="composer"/>
<property name="path.composer-require-checker.executable" value="${path.bin}/composer-require-checker"/>
<property name="path.composer-dependency-analyser.config" value="${path.build}/composer-dependency-analyser.config.php"/>
<property name="path.composer-dependency-analyser.executable" value="${path.bin}/composer-dependency-analyser"/>
<property name="path.phpcs.executable" value="${path.bin}/phpcs"/>
<property name="path.phpcs.ruleset" value="${path.build}/cs-ruleset.xml"/>
<property name="path.phplint.executable" value="${path.bin}/parallel-lint"/>
Expand All @@ -29,7 +30,7 @@
phplint,
cs,
tests,
composer-require-checker
composer-dependencies
"/>

<target name="composer" depends="composer-validate">
Expand All @@ -43,13 +44,15 @@
</exec>
</target>

<target name="composer-require-checker">
<target name="composer-dependencies">
<exec
executable="${path.composer-require-checker.executable}"
executable="${path.composer-dependency-analyser.executable}"
logoutput="true"
passthru="true"
checkreturn="true"
/>
>
<arg value="--config=${path.composer-dependency-analyser.config}"/>
</exec>
</target>

<target name="composer-validate">
Expand Down Expand Up @@ -80,6 +83,7 @@
<arg value="--report=full"/>
<arg value="--report-checkstyle=${path.build.log}/phpcs-checkstyle.xml"/>
<arg value="-sp"/>
<arg path="${path.build}"/>
<arg path="${path.src}"/>
<arg path="${path.tests}"/>
</exec>
Expand Down
26 changes: 26 additions & 0 deletions build/composer-dependency-analyser.config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

declare(strict_types = 1);

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

$config = new Configuration();

$config = $config->enableAnalysisOfUnusedDevDependencies();
$config = $config->addPathToScan(__DIR__, true);

// opt-in Symfony functionality
$config = $config->ignoreErrorsOnPackages([
'symfony/yaml',
], [ErrorType::UNUSED_DEPENDENCY]);

// tools
$config = $config->ignoreErrorsOnPackages([
'consistence/coding-standard',
'phing/phing',
'php-parallel-lint/php-console-highlighter',
'php-parallel-lint/php-parallel-lint',
], [ErrorType::UNUSED_DEPENDENCY]);

return $config;
5 changes: 2 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,20 @@
"symfony/console": "^4.4|^5.0",
"symfony/dependency-injection": "^4.4|^5.0",
"symfony/error-handler": "^4.4.1|^5.0.1",
"symfony/http-foundation": "^4.4|^5.0",
"symfony/http-kernel": "^4.4|^5.0",
"symfony/yaml": "^4.4|^5.0",
"tracy/tracy": "^2.4"
},
"require-dev": {
"consistence/coding-standard": "3.10.1",
"maglnet/composer-require-checker": "2.0",
"matthiasnoback/symfony-dependency-injection-test": "4.3",
"mikey179/vfsstream": "1.6.10",
"php-parallel-lint/php-console-highlighter": "1.0",
"php-parallel-lint/php-parallel-lint": "1.3.2",
"phing/phing": "2.17.2",
"phpunit/phpunit": "8.5.25",
"symfony/framework-bundle": "^4.4|^5.0"
"symfony/framework-bundle": "^4.4|^5.0",
"shipmonk/composer-dependency-analyser": "1.8.1"
},
"autoload": {
"psr-4": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ public function testReplaceErrorRenderer(
{
$this->setParameter('kernel.project_dir', __DIR__);
$this->setParameter('kernel.logs_dir', __DIR__ . '/tests-logs-dir');
$this->setParameter('kernel.build_dir', __DIR__ . '/tests-build-dir');
$this->setParameter('kernel.cache_dir', __DIR__ . '/tests-cache-dir');
$this->setParameter('kernel.environment', $kernelEnvironment);
$this->setParameter('kernel.debug', $kernelDebugParameter);
Expand Down

0 comments on commit 370095e

Please sign in to comment.