Skip to content

Commit 2d02544

Browse files
QWp6tretlehs
authored andcommitted
Create new phpcs rules
1 parent 1df3fee commit 2d02544

File tree

4 files changed

+62
-47
lines changed

4 files changed

+62
-47
lines changed

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,6 @@ install:
4343

4444
script:
4545
- npm run build
46-
- phpcs --standard=ruleset.xml --extensions=php --ignore=node_modules,bower_components,vendor -n -s .
46+
- phpcs --report=summary
47+
- phpcs --report=summary --standard=phpcs-templates.xml -n
4748
- phpmd src text cleancode,codesize,controversial,design,naming,unusedcode

phpcs-templates.xml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="Roots">
3+
<description>Roots Templates Coding Standards</description>
4+
5+
<!-- Scan these files by default -->
6+
<file>templates</file>
7+
8+
<!-- Show colors in console -->
9+
<arg value="-colors"/>
10+
11+
<!-- Show sniff codes in all reports -->
12+
<arg value="s"/>
13+
14+
<!-- Use PSR-2 as a base -->
15+
<rule ref="PSR2">
16+
<!-- Allow closing braces to be on the same line -->
17+
<exclude name="Squiz.WhiteSpace.ScopeClosingBrace"/>
18+
19+
<!-- Disable newline after opening brace -->
20+
<exclude name="Squiz.ControlStructures.ControlSignature.NewlineAfterOpenBrace"/>
21+
22+
<!-- Allow multiple PHP statements in the same line -->
23+
<exclude name="Generic.Formatting.DisallowMultipleStatements.SameLine"/>
24+
25+
<!-- Disable PSR-2 indentation rules that are buggy with 2 spaces -->
26+
<exclude name="PSR2.ControlStructures.SwitchDeclaration.BreakIndent"/>
27+
<exclude name="PSR2.Methods.FunctionCallSignature.Indent"/>
28+
29+
<!-- Don't require a blank line after the last `use` -->
30+
<exclude name="PSR2.Namespaces.UseDeclaration.SpaceAfterLastUse"/>
31+
32+
<!-- Allow PHP closing tags -->
33+
<exclude name="PSR2.Files.ClosingTag.NotAllowed"/>
34+
</rule>
35+
36+
<!-- Force 2 spaces indentation -->
37+
<rule ref="Generic.WhiteSpace.ScopeIndent">
38+
<properties>
39+
<property name="indent" value="2"/>
40+
<property name="tabIndent" value="false"/>
41+
</properties>
42+
</rule>
43+
</ruleset>

phpcs.xml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="Roots">
3+
<description>Roots Coding Standards</description>
4+
5+
<!-- Use PSR-2 as a base -->
6+
<rule ref="PSR2"/>
7+
8+
<!-- Show colors in console -->
9+
<arg value="-colors"/>
10+
11+
<!-- Show sniff codes in all reports -->
12+
<arg value="s"/>
13+
14+
<!-- Scan these files -->
15+
<file>functions.php</file>
16+
<file>src</file>
17+
</ruleset>

ruleset.xml

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

0 commit comments

Comments
 (0)