Skip to content

Commit ab95d52

Browse files
committed
[FEATURE] Add line length code check and fixer
1 parent c7eb1c1 commit ab95d52

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

composer.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"rawr/phpunit-data-provider": "3.3.1",
3838
"rector/rector": "1.2.10 || 2.1.7",
3939
"rector/type-perfect": "1.0.0 || 2.1.0",
40+
"squizlabs/php_codesniffer": "4.0.1",
4041
"thecodingmachine/phpstan-safe-rule": "1.2.0 || 1.4.1"
4142
},
4243
"suggest": {
@@ -75,13 +76,15 @@
7576
"check:dynamic": [
7677
"@check:tests"
7778
],
79+
"check:php:codesniffer": "phpcs --standard=config/phpcs.xml config src tests",
7880
"check:php:fixer": "\"./.phive/php-cs-fixer\" --config=config/php-cs-fixer.php fix --dry-run -v --show-progress=dots --diff bin src tests config",
7981
"check:php:lint": "parallel-lint src tests config bin",
8082
"check:php:rector": "rector --no-progress-bar --dry-run --config=config/rector.php",
8183
"check:php:stan": "phpstan --no-progress --configuration=config/phpstan.neon",
8284
"check:static": [
8385
"@check:composer:normalize",
8486
"@check:php:fixer",
87+
"@check:php:codesniffer",
8588
"@check:php:lint",
8689
"@check:php:rector",
8790
"@check:php:stan"
@@ -99,8 +102,10 @@
99102
"fix:php": [
100103
"@fix:composer:normalize",
101104
"@fix:php:rector",
105+
"@fix:php:codesniffer",
102106
"@fix:php:fixer"
103107
],
108+
"fix:php:codesniffer": "phpcbf --standard=config/phpcs.xml config src tests",
104109
"fix:php:fixer": "\"./.phive/php-cs-fixer\" --config=config/php-cs-fixer.php fix bin src tests",
105110
"fix:php:rector": "rector --config=config/rector.php",
106111
"phpstan:baseline": "phpstan --configuration=config/phpstan.neon --generate-baseline=config/phpstan-baseline.neon --allow-empty-baseline"
@@ -109,6 +114,7 @@
109114
"check": "Runs all dynamic and static code checks.",
110115
"check:composer:normalize": "Checks the formatting and structure of the composer.json.",
111116
"check:dynamic": "Runs all dynamic code checks (i.e., currently, the unit tests).",
117+
"check:php:codesniffer": "Checks the code style with PHP_CodeSniffer.",
112118
"check:php:fixer": "Checks the code style with PHP CS Fixer.",
113119
"check:php:lint": "Checks the syntax of the PHP code.",
114120
"check:php:rector": "Checks the code for possible code updates and refactoring.",
@@ -121,6 +127,7 @@
121127
"fix": "Runs all fixers",
122128
"fix:composer:normalize": "Reformats and sorts the composer.json file.",
123129
"fix:php": "Autofixes all autofixable issues in the PHP code.",
130+
"fix:php:codesniffer": "Reformats the code with PHP_CodeSniffer.",
124131
"fix:php:fixer": "Fixes autofixable issues found by PHP CS Fixer.",
125132
"fix:php:rector": "Fixes autofixable issues found by Rector.",
126133
"phpstan:baseline": "Updates the PHPStan baseline file to match the code."

config/phpcs.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ruleset name="MyIntervals coding standard">
3+
<arg name="colors"/>
4+
<arg name="extensions" value="php"/>
5+
6+
<rule ref="Generic.Files.LineLength">
7+
<properties>
8+
<property name="lineLimit" value="120"/>
9+
<property name="absoluteLineLimit" value="120"/>
10+
</properties>
11+
</rule>
12+
</ruleset>

0 commit comments

Comments
 (0)