Skip to content

Commit 9c4f04c

Browse files
committed
Add dev instruments
1 parent d9ad8ba commit 9c4f04c

File tree

6 files changed

+464
-6
lines changed

6 files changed

+464
-6
lines changed

composer.json

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"console"
1111
],
1212
"homepage": "https://github.com/andrey-tech/phpunit-cobertura-formatter-php",
13-
"minimum-stability": "dev",
13+
"minimum-stability": "stable",
1414
"license": "MIT",
1515
"authors": [
1616
{
@@ -26,11 +26,20 @@
2626
"require": {
2727
"php": "^8.3",
2828
"ext-simplexml": "*",
29-
"justinrainbow/json-schema": "^6.0",
30-
"symfony/console": "^5.4 || ^6.4 || ^7.3",
31-
"symfony/yaml": "^5.4 || ^6.4 || ^7.3"
29+
"justinrainbow/json-schema": "^6.5.2",
30+
"symfony/console": "^5.4 || ^6.4.25 || ^7.4",
31+
"symfony/yaml": "^5.4 || ^6.4.25 || ^7.4"
3232
},
3333
"require-dev": {
34+
"andrey-tech/pdepend-summary-formatter-php": "^1.2.2",
35+
"dg/bypass-finals": "^1.9",
36+
"overtrue/phplint": "^9.6.2",
37+
"pdepend/pdepend": "^2.16.2",
38+
"phpmd/phpmd": "^2.15",
39+
"phpunit/phpunit": "^12.3.8",
40+
"slevomat/coding-standard": "^8.22",
41+
"squizlabs/php_codesniffer": "^3.13.4",
42+
"vimeo/psalm": "^6.13.1"
3443
},
3544
"conflict": {
3645
},
@@ -39,6 +48,7 @@
3948
"config": {
4049
"sort-packages": true,
4150
"allow-plugins": {
51+
"dealerdirect/phpcodesniffer-composer-installer": true
4252
}
4353
},
4454
"autoload": {
@@ -50,8 +60,17 @@
5060
"bin/phpunit-cobertura-formatter"
5161
],
5262
"scripts": {
53-
"post-install-cmd": [
54-
"AndreyTech\\PHPUnit\\Cobertura\\Formatter\\Installer::postInstall"
63+
"lint": "phplint --configuration=phplint.yml.dist",
64+
"cs": "phpcs -s -p --report=full --standard=phpcs.xml.dist",
65+
"psalm": "psalm --long-progress --output-format=compact --config=psalm.xml.dist",
66+
"phpmd": "phpmd src ansi phpmd.xml.dist --suffixes php --ignore-violations-on-exit",
67+
"pdepend": "pdepend --summary-xml=.summary.xml --suffix=php src && pdepend-summary-formatter --init && pdepend-summary-formatter .summary.xml --config-file=pdepend-summary-formatter.yml.dist --ignore-red-metrics-on-exit --ignore-yellow-metrics-on-exit",
68+
"check": [
69+
"@lint",
70+
"@cs",
71+
"@psalm",
72+
"@phpmd",
73+
"@pdepend"
5574
]
5675
}
5776
}

pdepend-summary-formatter.yml.dist

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
colorizer:
2+
metrics:
3+
4+
# Metrics of class
5+
class:
6+
7+
# https://learn.microsoft.com/en-us/visualstudio/code-quality/code-metrics-class-coupling?view=vs-2022
8+
# https://phpmd.org/rules/design.html#couplingbetweenobjects
9+
# https://pdepend.org/documentation/software-metrics/coupling-between-objects.html
10+
cbo:
11+
green: [ 0, 13 ]
12+
red+bold: [ 14, null ]
13+
14+
# https://phpmd.org/rules/codesize.html#excessiveclasslength
15+
loc:
16+
green: [ 0, 1000 ]
17+
red+bold: [ 1001, null ]
18+
19+
# https://phpmd.org/rules/codesize.html#excessivepubliccount
20+
# https://pdepend.org/documentation/software-metrics/class-interface-size.html
21+
# https://pdepend.org/documentation/software-metrics/class-size.html
22+
cis:
23+
green: [ 0, 45 ]
24+
red+bold: [ 46, null ]
25+
26+
# https://phpmd.org/rules/codesize.html#toomanymethods
27+
nom:
28+
green: [ 0, 25 ]
29+
red+bold: [ 26, null ]
30+
31+
# https://phpmd.org/rules/codesize.html#toomanypublicmethods
32+
npm:
33+
green: [ 0, 20 ]
34+
red+bold: [ 21, null ]
35+
36+
# https://phpmd.org/rules/codesize.html#toomanyfields
37+
vars:
38+
green: [ 0, 15 ]
39+
red+bold: [ 16, null ]
40+
41+
# https://phpmd.org/rules/codesize.html#excessiveclasscomplexity
42+
# https://pdepend.org/documentation/software-metrics/weighted-method-count.html
43+
wmc:
44+
green: [ 0, 50 ]
45+
red+bold: [ 51, null ]
46+
47+
# https://learn.microsoft.com/ru-ru/visualstudio/code-quality/code-metrics-depth-of-inheritance?view=vs-2022
48+
# https://phpmd.org/rules/design.html#depthofinheritance
49+
dit:
50+
green: [ 0, 6 ]
51+
red+bold: [ 7, null ]
52+
53+
# https://phpmd.org/rules/design.html#numberofchildren
54+
nocc:
55+
green: [ 0, 15 ]
56+
red+bold: [ 16, null ]
57+
58+
# Metrics of method
59+
method:
60+
61+
# https://learn.microsoft.com/ru-ru/visualstudio/code-quality/code-metrics-cyclomatic-complexity?view=vs-2022
62+
# https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
63+
ccn:
64+
green: [ 1, 7 ]
65+
yellow+bold: [ 8, 10 ]
66+
red+bold: [ 11, null ]
67+
68+
# https://stackoverflow.com/questions/27954015/cyclomatic-complexity-and-variants
69+
ccn2:
70+
green: [ 1, 7 ]
71+
yellow+bold: [ 8, 10 ]
72+
red+bold: [ 11, null ]
73+
74+
# https://phpmd.org/rules/codesize.html#npathcomplexity
75+
# https://modess.io/npath-complexity-cyclomatic-complexity-explained/
76+
npath:
77+
green: [ 1, 200 ]
78+
red+bold: [ 201, null ]
79+
80+
# https://learn.microsoft.com/en-us/visualstudio/code-quality/code-metrics-maintainability-index-range-and-meaning?view=vs-2022
81+
# https://habr.com/en/articles/111524/
82+
# https://forum.itvdn.com/t/o-chyom-govorit-metrika-maintainability-index/2423
83+
# https://verifysoft.com/en_maintainability.html
84+
# https://www.ijert.org/research/maintainability-index-over-multiple-releases-a-case-study-php-open-source-software-IJERTV1IS6424.pdf
85+
mi:
86+
green: [ 60, 100 ]
87+
yellow+bold: [ 50, 60 ]
88+
red+bold: [ 0, 50 ]
89+
90+
# https://phpmd.org/rules/codesize.html#excessivemethodlength
91+
loc:
92+
green: [ 0, 100 ]
93+
red+bold: [ 101, null ]
94+
95+
# https://en.wikipedia.org/wiki/Halstead_complexity_measures
96+
hb:
97+
green: [ 0, 0.09 ]
98+
yellow+bold: [ 0.10, null ]
99+
100+
# https://en.wikipedia.org/wiki/Halstead_complexity_measures
101+
# https://github.com/escomplex/complexity-report/blob/master/.complexrc.example
102+
hd:
103+
green: [ 0, 20 ]
104+
yellow+bold: [ 20, null ]
105+
106+
# https://en.wikipedia.org/wiki/Halstead_complexity_measures
107+
hv:
108+
green: [ 0, 400 ]
109+
yellow+bold: [ 400, null ]
110+
111+
# https://en.wikipedia.org/wiki/Halstead_complexity_measures
112+
he:
113+
green: [ 0, 5000 ]
114+
yellow+bold: [ 5000, null ]
115+
116+
# https://www.artima.com/weblogs/viewpost.jsp?thread=210575
117+
# https://stackoverflow.com/questions/4731774/how-to-read-improve-c-r-a-p-index-calculated-by-php
118+
crap0:
119+
green: [ 0, 29 ]
120+
yellow+bold: [ 30, null ]

0 commit comments

Comments
 (0)