Skip to content

Commit

Permalink
Create new phpcs rules
Browse files Browse the repository at this point in the history
  • Loading branch information
QWp6t authored and retlehs committed Mar 11, 2016
1 parent 1df3fee commit 2d02544
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 47 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,6 @@ install:

script:
- npm run build
- phpcs --standard=ruleset.xml --extensions=php --ignore=node_modules,bower_components,vendor -n -s .
- phpcs --report=summary
- phpcs --report=summary --standard=phpcs-templates.xml -n
- phpmd src text cleancode,codesize,controversial,design,naming,unusedcode
43 changes: 43 additions & 0 deletions phpcs-templates.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0"?>
<ruleset name="Roots">
<description>Roots Templates Coding Standards</description>

<!-- Scan these files by default -->
<file>templates</file>

<!-- Show colors in console -->
<arg value="-colors"/>

<!-- Show sniff codes in all reports -->
<arg value="s"/>

<!-- Use PSR-2 as a base -->
<rule ref="PSR2">
<!-- Allow closing braces to be on the same line -->
<exclude name="Squiz.WhiteSpace.ScopeClosingBrace"/>

<!-- Disable newline after opening brace -->
<exclude name="Squiz.ControlStructures.ControlSignature.NewlineAfterOpenBrace"/>

<!-- Allow multiple PHP statements in the same line -->
<exclude name="Generic.Formatting.DisallowMultipleStatements.SameLine"/>

<!-- Disable PSR-2 indentation rules that are buggy with 2 spaces -->
<exclude name="PSR2.ControlStructures.SwitchDeclaration.BreakIndent"/>
<exclude name="PSR2.Methods.FunctionCallSignature.Indent"/>

<!-- Don't require a blank line after the last `use` -->
<exclude name="PSR2.Namespaces.UseDeclaration.SpaceAfterLastUse"/>

<!-- Allow PHP closing tags -->
<exclude name="PSR2.Files.ClosingTag.NotAllowed"/>
</rule>

<!-- Force 2 spaces indentation -->
<rule ref="Generic.WhiteSpace.ScopeIndent">
<properties>
<property name="indent" value="2"/>
<property name="tabIndent" value="false"/>
</properties>
</rule>
</ruleset>
17 changes: 17 additions & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0"?>
<ruleset name="Roots">
<description>Roots Coding Standards</description>

<!-- Use PSR-2 as a base -->
<rule ref="PSR2"/>

<!-- Show colors in console -->
<arg value="-colors"/>

<!-- Show sniff codes in all reports -->
<arg value="s"/>

<!-- Scan these files -->
<file>functions.php</file>
<file>src</file>
</ruleset>
46 changes: 0 additions & 46 deletions ruleset.xml

This file was deleted.

0 comments on commit 2d02544

Please sign in to comment.