Skip to content

Commit 303699c

Browse files
paulbalandangr8man
authored andcommitted
chore: fix the composer normalize check and remove PhpMetrics (#10640)
1 parent a1c84d9 commit 303699c

6 files changed

Lines changed: 54 additions & 87 deletions

File tree

‎.gitattributes‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ utils/ export-ignore
2424
.php-cs-fixer.user-guide.php export-ignore
2525
structarmed-baseline.php export-ignore
2626
structarmed.php export-ignore
27-
phpmetrics.json export-ignore
2827
phpstan-baseline.php export-ignore
2928
phpstan-bootstrap.php export-ignore
3029
phpstan.dist.neon export-ignore

‎.github/workflows/test-autoreview.yml‎

Lines changed: 0 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -30,79 +30,3 @@ jobs:
3030
php-version: '8.2'
3131
job-id: auto-review-tests
3232
group-name: AutoReview
33-
34-
composer-normalize-tests:
35-
name: Check normalized composer.json
36-
runs-on: ubuntu-24.04
37-
steps:
38-
- name: Checkout
39-
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
40-
41-
- name: Setup PHP
42-
uses: shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # 2.40.0
43-
with:
44-
php-version: '8.2'
45-
46-
- name: Install dependencies
47-
run: composer update
48-
49-
- name: Run on root composer.json
50-
id: normalize-root-composer
51-
if: ${{ always() }}
52-
run: |
53-
echo "ROOT_COMPOSER_RESULT<<RCR" >> $GITHUB_OUTPUT
54-
echo "$(composer normalize)" >> $GITHUB_OUTPUT
55-
echo "RCR" >> $GITHUB_OUTPUT
56-
57-
- name: Run on framework composer.json
58-
id: normalize-framework-composer
59-
if: ${{ always() }}
60-
working-directory: admin/framework
61-
run: |
62-
echo "FRAMEWORK_COMPOSER_RESULT<<FCR" >> $GITHUB_OUTPUT
63-
echo "$(composer normalize)" >> $GITHUB_OUTPUT
64-
echo "FCR" >> $GITHUB_OUTPUT
65-
66-
- name: Run on starter composer.json
67-
id: normalize-starter-composer
68-
if: ${{ always() }}
69-
working-directory: admin/starter
70-
run: |
71-
echo "STARTER_COMPOSER_RESULT<<SCR" >> $GITHUB_OUTPUT
72-
echo "$(composer normalize)" >> $GITHUB_OUTPUT
73-
echo "SCR" >> $GITHUB_OUTPUT
74-
75-
- name: Analyse normalization results
76-
run: |
77-
if [[ '${{ steps.normalize-root-composer.conclusion }}' == 'failure' ]]; then
78-
echo 'Normalization of root composer.json encountered a problem.';
79-
echo 'Please run it locally: `composer normalize`';
80-
exit 1;
81-
fi
82-
83-
if [[ ${{ contains(steps.normalize-root-composer.outputs.ROOT_COMPOSER_RESULT, 'Successfully normalized') }} == true ]]; then
84-
echo 'Root composer.json is not yet normalized.';
85-
exit 1;
86-
fi
87-
88-
if [[ '${{ steps.normalize-framework-composer.conclusion }}' == 'failure' ]]; then
89-
echo 'Normalization of framework composer.json encountered a problem.';
90-
echo 'Please run it locally: `composer normalize -d admin/framework`';
91-
exit 1;
92-
fi
93-
94-
if [[ ${{ contains(steps.normalize-framework-composer.outputs.FRAMEWORK_COMPOSER_RESULT, 'Successfully normalized') }} == true ]]; then
95-
echo 'Framework composer.json is not yet normalized.';
96-
exit 1;
97-
fi
98-
99-
if [[ '${{ steps.normalize-starter-composer.conclusion }}' == 'failure' ]]; then
100-
echo 'Normalization of starter composer.json encountered a problem.';
101-
echo 'Please run it locally: `composer normalize -d admin/starter`';
102-
exit 1;
103-
fi
104-
105-
if [[ ${{ contains(steps.normalize-starter-composer.outputs.STARTER_COMPOSER_RESULT, 'Successfully normalized') }} == true ]]; then
106-
echo 'Starter composer.json is not yet normalized.';
107-
exit 1;
108-
fi
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Composer Normalize
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- '**/composer.json'
7+
- '.github/workflows/test-composer-normalize.yml'
8+
push:
9+
paths:
10+
- '**/composer.json'
11+
- '.github/workflows/test-composer-normalize.yml'
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
15+
cancel-in-progress: true
16+
17+
permissions:
18+
contents: read
19+
20+
jobs:
21+
composer-normalize:
22+
name: Check normalized composer.json
23+
runs-on: ubuntu-24.04
24+
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
28+
with:
29+
persist-credentials: false
30+
31+
- name: Setup PHP
32+
uses: shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # 2.40.0
33+
with:
34+
php-version: '8.2'
35+
coverage: none
36+
37+
- name: Install dependencies
38+
run: composer update --ansi --no-interaction --working-dir=utils
39+
40+
- name: Run on root composer.json
41+
if: ${{ !cancelled() }}
42+
run: composer normalize --ansi --dry-run --working-dir=utils "$GITHUB_WORKSPACE/composer.json"
43+
44+
- name: Run on framework composer.json
45+
if: ${{ !cancelled() }}
46+
run: composer normalize --ansi --dry-run --working-dir=utils "$GITHUB_WORKSPACE/admin/framework/composer.json"
47+
48+
- name: Run on starter composer.json
49+
if: ${{ !cancelled() }}
50+
run: composer normalize --ansi --dry-run --working-dir=utils "$GITHUB_WORKSPACE/admin/starter/composer.json"
51+
52+
- name: Run on utils composer.json
53+
if: ${{ !cancelled() }}
54+
run: composer normalize --ansi --dry-run --working-dir=utils

‎composer.json‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@
114114
"utils/vendor/bin/php-cs-fixer fix --ansi --verbose --diff --config=.php-cs-fixer.tests.php",
115115
"utils/vendor/bin/php-cs-fixer fix --ansi --verbose --diff"
116116
],
117-
"metrics": "utils/vendor/bin/phpmetrics --config=phpmetrics.json",
118117
"phpstan:baseline": [
119118
"phpstan analyse --ansi --generate-baseline=utils/phpstan-baseline/loader.neon",
120119
"split-phpstan-baseline utils/phpstan-baseline/loader.neon"
@@ -128,7 +127,6 @@
128127
"analyze": "Run static analysis",
129128
"cs": "Check the coding style",
130129
"cs-fix": "Fix the coding style",
131-
"metrics": "Run PhpMetrics",
132130
"phpstan:baseline": "Run PHPStan then dump all errors to baseline",
133131
"phpstan:check": "Run PHPStan with support for identifiers",
134132
"test": "Run unit tests"

‎phpmetrics.json‎

Lines changed: 0 additions & 7 deletions
This file was deleted.

‎utils/composer.json‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
"ergebnis/composer-normalize": "^2.28",
66
"friendsofphp/php-cs-fixer": "^3.76",
77
"nexusphp/cs-config": "^3.26",
8-
"phpmetrics/phpmetrics": "^2.8 || ^3.0rc6",
98
"vimeo/psalm": "^6.14"
109
},
1110
"autoload": {

0 commit comments

Comments
 (0)