Skip to content

Commit e9b502c

Browse files
authored
Merge pull request #601 from mimmi20/updates
add config for composer-dependency-analyser
2 parents a55c2c9 + bf64430 commit e9b502c

File tree

5 files changed

+51
-2
lines changed

5 files changed

+51
-2
lines changed

.github/workflows/continuous-integration.yml

-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ jobs:
5757
skip-phpcs: false
5858
skip-phpstan: false
5959
skip-rector: false
60-
skip-phpmd: true
6160
skip-eslint: true
6261
skip-stylelint: true
6362
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

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
3+
/**
4+
* This file is part of the mimmi20/monolog-factory package.
5+
*
6+
* Copyright (c) 2022-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__ . '/src', [ErrorType::UNKNOWN_CLASS])
34+
->ignoreErrorsOnPath(__DIR__ . '/tests', [ErrorType::UNKNOWN_CLASS])
35+
->ignoreErrorsOnPath(__DIR__ . '/vendor', [ErrorType::DEV_DEPENDENCY_IN_PROD])
36+
->ignoreErrorsOnPath(__DIR__ . '/src', [ErrorType::DEV_DEPENDENCY_IN_PROD])
37+
38+
// do not complain about some modules
39+
->ignoreErrorsOnPackage('mimmi20/coding-standard', [ErrorType::UNUSED_DEPENDENCY])
40+
->ignoreErrorsOnPackage('phpstan/extension-installer', [ErrorType::UNUSED_DEPENDENCY])
41+
->ignoreErrorsOnPackage('phpstan/phpstan-phpunit', [ErrorType::UNUSED_DEPENDENCY])
42+
->ignoreErrorsOnPackage('phpstan/phpstan-deprecation-rules', [ErrorType::UNUSED_DEPENDENCY])
43+
44+
// Adjust analysis
45+
// dev packages are often used only in CI, so this is not enabled by default
46+
->enableAnalysisOfUnusedDevDependencies();
47+
48+
return $config;

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
"mikey179/vfsstream": "^1.6.12",
4646
"mimmi20/coding-standard": "^6.0.1",
4747
"mimmi20/monolog-callbackfilterhandler": "^4.0.0",
48-
"mimmi20/monolog-streamformatter": "^4.0.1",
4948
"nikic/php-parser": "^5.3.1",
5049
"php-console/php-console": "^3.1.8",
5150
"phpstan/extension-installer": "^1.4.3",
@@ -57,6 +56,7 @@
5756
"rector/rector": "^1.2.10",
5857
"rector/type-perfect": "^1.0.0",
5958
"ruflin/elastica": "^8.1.0",
59+
"shipmonk/composer-dependency-analyser": "^1.8.1",
6060
"symfony/mailer": "^7.2.0",
6161
"symfony/mime": "^7.2.1",
6262
"symfony/process": "^7.2.0",

phpcs.xml

+1
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,5 @@
2323
<file>tests</file>
2424
<file>.php-cs-fixer.php</file>
2525
<file>rector.php</file>
26+
<file>composer-dependency-analyser.php</file>
2627
</ruleset>

0 commit comments

Comments
 (0)