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

add config for composer-dependency-analyser #403

Merged
merged 1 commit into from
Dec 29, 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
12 changes: 6 additions & 6 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
version: "2"
checks:
argument-count:
enabled: true
enabled: false
complex-logic:
enabled: true
enabled: false
file-lines:
enabled: false
method-complexity:
enabled: true
enabled: false
method-count:
enabled: true
enabled: false
method-lines:
enabled: true
enabled: false
nested-control-flow:
enabled: true
return-statements:
enabled: true
enabled: false
similar-code:
enabled: false
identical-code:
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ jobs:
skip-phpcs: false
skip-phpstan: false
skip-rector: false
skip-phpmd: false
skip-eslint: true
skip-stylelint: true
skip-prettier: true
Expand Down
7 changes: 5 additions & 2 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@

declare(strict_types = 1);

$header = <<<'EOF'
$year = date('Y');

$header = <<<EOF
This file is part of the ios-build package.

Copyright (c) 2019-2024, Thomas Mueller <mimmi20@live.de>
Copyright (c) 2019-{$year}, Thomas Mueller <mimmi20@live.de>

For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
Expand All @@ -26,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
6 changes: 5 additions & 1 deletion codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@ codecov:
require_ci_to_pass: false
notify:
wait_for_ci: false

coverage:
status:
project:
default:
default: # default is the status check's name, not default settings
target: 100%
threshold: 1%
if_ci_failed: success #success, failure, error, ignore
informational: true
only_pulls: false
patch:
default:
informational: true
Expand Down
45 changes: 45 additions & 0 deletions composer-dependency-analyser.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

/**
* This file is part of the ios-build package.
*
* Copyright (c) 2019-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])

// 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;
2 changes: 2 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"require-dev": {
"ext-ctype": "*",
"ext-dom": "*",
"ext-mbstring": "*",
"ext-simplexml": "*",
"ext-tokenizer": "*",
"ext-xml": "*",
Expand All @@ -39,6 +40,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 @@ -18,4 +18,5 @@
<file>tests</file>
<file>.php-cs-fixer.php</file>
<file>rector.php</file>
<file>composer-dependency-analyser.php</file>
</ruleset>
36 changes: 0 additions & 36 deletions phpmd.ruleset.xml

This file was deleted.

Loading