Skip to content

Commit

Permalink
Merge pull request #180 from mimmi20/updates
Browse files Browse the repository at this point in the history
add config for composer-dependency-analyser
  • Loading branch information
mimmi20 authored Dec 28, 2024
2 parents 023facb + 096f993 commit d410af6
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 2 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
skip-phplint: false
skip-check-composer: false
skip-ec-checker: false
dependency-analyser-options: "--ignore-dev-in-prod-deps"
dependency-analyser-options: ""

install:
name: "Install Project"
Expand Down Expand Up @@ -59,7 +59,6 @@ jobs:
skip-phpcs: false
skip-phpstan: false
skip-rector: false
skip-phpmd: true
skip-eslint: true
skip-stylelint: true
skip-prettier: true
Expand Down
1 change: 1 addition & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
->in(__DIR__ . '/src')
->in(__DIR__ . '/tests')
->append([__DIR__ . '/rector.php'])
->append([__DIR__ . '/composer-dependency-analyser.php'])
->append([__FILE__]);

$rules = require 'vendor/mimmi20/coding-standard/src/php-cs-fixer.config.php';
Expand Down
46 changes: 46 additions & 0 deletions composer-dependency-analyser.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php

/**
* This file is part of the mimmi20/laminasviewrenderer-revision package.
*
* Copyright (c) 2023-2024, Thomas Mueller <mimmi20@live.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

declare(strict_types = 1);

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

$config = new Configuration();

$config
// Adjusting scanned paths
->addPathToScan(__DIR__ . '/src', isDev: false)
->addPathToScan(__DIR__ . '/tests', isDev: true)
->addPathToScan(__DIR__ . '/vendor', isDev: false)
->addPathToExclude(__DIR__ . '/vendor/rector/rector')
->addPathToExclude(__DIR__ . '/vendor/phpstan/phpstan')
// applies only to directory scanning, not directly listed files
->setFileExtensions(['php'])

// Ignoring errors in vendor directory
->ignoreErrorsOnPath(__DIR__ . '/vendor', [ErrorType::SHADOW_DEPENDENCY])
->ignoreErrorsOnPath(__DIR__ . '/vendor', [ErrorType::UNKNOWN_FUNCTION])
->ignoreErrorsOnPath(__DIR__ . '/vendor', [ErrorType::UNKNOWN_CLASS])
->ignoreErrorsOnPath(__DIR__ . '/vendor', [ErrorType::DEV_DEPENDENCY_IN_PROD])
->ignoreErrorsOnPath(__DIR__ . '/src', [ErrorType::DEV_DEPENDENCY_IN_PROD])

// do not complain about some modules
->ignoreErrorsOnPackage('mimmi20/coding-standard', [ErrorType::UNUSED_DEPENDENCY])
->ignoreErrorsOnPackage('phpstan/extension-installer', [ErrorType::UNUSED_DEPENDENCY])
->ignoreErrorsOnPackage('phpstan/phpstan-phpunit', [ErrorType::UNUSED_DEPENDENCY])
->ignoreErrorsOnPackage('phpstan/phpstan-deprecation-rules', [ErrorType::UNUSED_DEPENDENCY])

// Adjust analysis
// dev packages are often used only in CI, so this is not enabled by default
->enableAnalysisOfUnusedDevDependencies();

return $config;
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"phpunit/phpunit": "^11.5.2",
"rector/rector": "^1.2.10",
"rector/type-perfect": "^1.0.0",
"shipmonk/composer-dependency-analyser": "^1.8.1",
"symfony/process": "^7.2.0",
"symplify/phpstan-rules": "^13.0.1",
"tomasvotruba/cognitive-complexity": "^0.2.3",
Expand Down
1 change: 1 addition & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@
<file>tests</file>
<file>.php-cs-fixer.php</file>
<file>rector.php</file>
<file>composer-dependency-analyser.php</file>
</ruleset>

0 comments on commit d410af6

Please sign in to comment.