Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace Composer Require Checker with more capable Composer Dependency Analyser #44

Merged
merged 1 commit into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
21 changes: 21 additions & 0 deletions build/composer-dependency-analyser.config.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();

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

// 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;
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
"ext-simplexml": "*",
"consistence/coding-standard": "3.10.1",
"doctrine/annotations": "1.14.2",
"maglnet/composer-require-checker": "2.0",
"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"
"phpunit/phpunit": "8.5.25",
"shipmonk/composer-dependency-analyser": "1.8.1"
},
"autoload": {
"psr-4": { "Consistence\\JmsSerializer\\": [ "src" ] },
Expand Down
Loading