Skip to content

Commit 51fe610

Browse files
jrfnlsirbrillig
authored andcommitted
PHPCS: document run parameters in project ruleset (#107)
* PHPCS: document run parameters in project ruleset This makes it easier to run the PHPCS command for the project. Includes: * Adding the `Tests` directory to the run - excluding the test case files in `fixtures`. * Cleaning up the result report by using the `basepath` configuration. * Making the run faster by using `parallel` scanning if available, * Composer: remove `lint-self` and add ruleset to the PHPCS config instead
1 parent 06dda92 commit 51fe610

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

.circleci/config.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ jobs:
99
- run: COMPOSER=composer.json composer test
1010
- run: COMPOSER=composer.json composer phpstan
1111
- run: COMPOSER=composer.json composer lint
12-
- run: COMPOSER=composer.json composer lint-self
1312
build_php5:
1413
docker:
1514
- image: circleci/php:5.6.40-zts-stretch-node-browsers-legacy

composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@
3030
"prefer-stable": true,
3131
"scripts": {
3232
"test": "./vendor/bin/phpunit",
33-
"lint": "./vendor/bin/phpcs -s -p VariableAnalysis/Sniffs VariableAnalysis/Lib",
34-
"lint-self": "./vendor/bin/phpcs --standard=./VariableAnalysis -s -p VariableAnalysis/Sniffs VariableAnalysis/Lib",
33+
"lint": "./vendor/bin/phpcs",
3534
"phpstan": "./vendor/bin/phpstan analyse -l 7 VariableAnalysis"
3635
},
3736
"require" : {

phpcs.xml.dist

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,23 @@
66
- bracers on end of line instead new line
77
- two space indentation
88
</description>
9+
10+
<file>./VariableAnalysis/</file>
11+
<exclude-pattern>./VariableAnalysis/Tests/CodeAnalysis/fixtures/</exclude-pattern>
12+
13+
<!-- Only check PHP files. -->
14+
<arg name="extensions" value="php"/>
15+
16+
<!-- Show progress, show the error codes for each message (source). -->
17+
<arg value="sp"/>
18+
19+
<!-- Strip the filepaths down to the relevant bit. -->
20+
<arg name="basepath" value="./"/>
21+
22+
<!-- Check up to 8 files simultaneously. -->
23+
<arg name="parallel" value="8"/>
24+
25+
<!-- Rules -->
926
<rule ref="PSR2">
1027
<exclude name="Squiz.Functions.MultiLineFunctionDeclaration.BraceOnSameLine" />
1128
<exclude name="PSR2.Classes.ClassDeclaration.OpenBraceNewLine" />
@@ -31,4 +48,5 @@
3148
<rule ref="Generic.Functions.OpeningFunctionBraceKernighanRitchie" />
3249
<rule ref="Generic.Classes.OpeningBraceSameLine"/>
3350
<rule ref="ImportDetection" />
51+
<rule ref="VariableAnalysis"/>
3452
</ruleset>

0 commit comments

Comments
 (0)