Skip to content

Commit d410af6

Browse files
authored
Merge pull request #180 from mimmi20/updates
add config for composer-dependency-analyser
2 parents 023facb + 096f993 commit d410af6

File tree

5 files changed

+50
-2
lines changed

5 files changed

+50
-2
lines changed

.github/workflows/continuous-integration.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
skip-phplint: false
3131
skip-check-composer: false
3232
skip-ec-checker: false
33-
dependency-analyser-options: "--ignore-dev-in-prod-deps"
33+
dependency-analyser-options: ""
3434

3535
install:
3636
name: "Install Project"
@@ -59,7 +59,6 @@ jobs:
5959
skip-phpcs: false
6060
skip-phpstan: false
6161
skip-rector: false
62-
skip-phpmd: true
6362
skip-eslint: true
6463
skip-stylelint: true
6564
skip-prettier: true

.php-cs-fixer.php

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
->in(__DIR__ . '/src')
2929
->in(__DIR__ . '/tests')
3030
->append([__DIR__ . '/rector.php'])
31+
->append([__DIR__ . '/composer-dependency-analyser.php'])
3132
->append([__FILE__]);
3233

3334
$rules = require 'vendor/mimmi20/coding-standard/src/php-cs-fixer.config.php';

composer-dependency-analyser.php

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?php
2+
3+
/**
4+
* This file is part of the mimmi20/laminasviewrenderer-revision package.
5+
*
6+
* Copyright (c) 2023-2024, Thomas Mueller <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
declare(strict_types = 1);
13+
14+
use ShipMonk\ComposerDependencyAnalyser\Config\Configuration;
15+
use ShipMonk\ComposerDependencyAnalyser\Config\ErrorType;
16+
17+
$config = new Configuration();
18+
19+
$config
20+
// Adjusting scanned paths
21+
->addPathToScan(__DIR__ . '/src', isDev: false)
22+
->addPathToScan(__DIR__ . '/tests', isDev: true)
23+
->addPathToScan(__DIR__ . '/vendor', isDev: false)
24+
->addPathToExclude(__DIR__ . '/vendor/rector/rector')
25+
->addPathToExclude(__DIR__ . '/vendor/phpstan/phpstan')
26+
// applies only to directory scanning, not directly listed files
27+
->setFileExtensions(['php'])
28+
29+
// Ignoring errors in vendor directory
30+
->ignoreErrorsOnPath(__DIR__ . '/vendor', [ErrorType::SHADOW_DEPENDENCY])
31+
->ignoreErrorsOnPath(__DIR__ . '/vendor', [ErrorType::UNKNOWN_FUNCTION])
32+
->ignoreErrorsOnPath(__DIR__ . '/vendor', [ErrorType::UNKNOWN_CLASS])
33+
->ignoreErrorsOnPath(__DIR__ . '/vendor', [ErrorType::DEV_DEPENDENCY_IN_PROD])
34+
->ignoreErrorsOnPath(__DIR__ . '/src', [ErrorType::DEV_DEPENDENCY_IN_PROD])
35+
36+
// do not complain about some modules
37+
->ignoreErrorsOnPackage('mimmi20/coding-standard', [ErrorType::UNUSED_DEPENDENCY])
38+
->ignoreErrorsOnPackage('phpstan/extension-installer', [ErrorType::UNUSED_DEPENDENCY])
39+
->ignoreErrorsOnPackage('phpstan/phpstan-phpunit', [ErrorType::UNUSED_DEPENDENCY])
40+
->ignoreErrorsOnPackage('phpstan/phpstan-deprecation-rules', [ErrorType::UNUSED_DEPENDENCY])
41+
42+
// Adjust analysis
43+
// dev packages are often used only in CI, so this is not enabled by default
44+
->enableAnalysisOfUnusedDevDependencies();
45+
46+
return $config;

composer.json

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
"phpunit/phpunit": "^11.5.2",
4444
"rector/rector": "^1.2.10",
4545
"rector/type-perfect": "^1.0.0",
46+
"shipmonk/composer-dependency-analyser": "^1.8.1",
4647
"symfony/process": "^7.2.0",
4748
"symplify/phpstan-rules": "^13.0.1",
4849
"tomasvotruba/cognitive-complexity": "^0.2.3",

phpcs.xml

+1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@
1717
<file>tests</file>
1818
<file>.php-cs-fixer.php</file>
1919
<file>rector.php</file>
20+
<file>composer-dependency-analyser.php</file>
2021
</ruleset>

0 commit comments

Comments
 (0)