Use phpcs.xml for all rules
This commit is contained in:
@@ -44,5 +44,4 @@ install:
|
|||||||
script:
|
script:
|
||||||
- npm run build
|
- npm run build
|
||||||
- phpcs --report=summary
|
- phpcs --report=summary
|
||||||
- phpcs --report=summary --standard=phpcs-templates.xml -n
|
|
||||||
- phpmd src text cleancode,codesize,controversial,design,naming,unusedcode
|
- phpmd src text cleancode,codesize,controversial,design,naming,unusedcode
|
||||||
|
|||||||
@@ -1,43 +0,0 @@
|
|||||||
<?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>
|
|
||||||
43
phpcs.xml
43
phpcs.xml
@@ -3,6 +3,7 @@
|
|||||||
<description>Roots Coding Standards</description>
|
<description>Roots Coding Standards</description>
|
||||||
|
|
||||||
<!-- Scan these files -->
|
<!-- Scan these files -->
|
||||||
|
<file>templates</file>
|
||||||
<file>functions.php</file>
|
<file>functions.php</file>
|
||||||
<file>src</file>
|
<file>src</file>
|
||||||
|
|
||||||
@@ -14,7 +15,47 @@
|
|||||||
|
|
||||||
<!-- Use PSR-2 as a base -->
|
<!-- Use PSR-2 as a base -->
|
||||||
<rule ref="PSR2">
|
<rule ref="PSR2">
|
||||||
<!-- Allow braces on same line for procedural functions -->
|
<!-- Allow braces on same line for named functions -->
|
||||||
<exclude name="Squiz.Functions.MultiLineFunctionDeclaration.BraceOnSameLine"/>
|
<exclude name="Squiz.Functions.MultiLineFunctionDeclaration.BraceOnSameLine"/>
|
||||||
</rule>
|
</rule>
|
||||||
|
|
||||||
|
<!-- Allow closing braces to be on the same line -->
|
||||||
|
<rule ref="Squiz.WhiteSpace.ScopeClosingBrace">
|
||||||
|
<exclude-pattern>templates</exclude-pattern>
|
||||||
|
</rule>
|
||||||
|
|
||||||
|
<!-- Disable newline after opening brace -->
|
||||||
|
<rule ref="Squiz.ControlStructures.ControlSignature.NewlineAfterOpenBrace">
|
||||||
|
<exclude-pattern>templates</exclude-pattern>
|
||||||
|
</rule>
|
||||||
|
|
||||||
|
<!-- Allow multiple PHP statements in the same line -->
|
||||||
|
<rule ref="Generic.Formatting.DisallowMultipleStatements.SameLine">
|
||||||
|
<exclude-pattern>templates</exclude-pattern>
|
||||||
|
</rule>
|
||||||
|
|
||||||
|
<!-- Disable PSR-2 indentation rules that are buggy with 2 spaces -->
|
||||||
|
<rule ref="PSR2.ControlStructures.SwitchDeclaration.BreakIndent">
|
||||||
|
<exclude-pattern>templates</exclude-pattern>
|
||||||
|
</rule>
|
||||||
|
|
||||||
|
<!-- Don't require a blank line after the last `use` -->
|
||||||
|
<rule ref="PSR2.Namespaces.UseDeclaration.SpaceAfterLastUse">
|
||||||
|
<exclude-pattern>templates</exclude-pattern>
|
||||||
|
</rule>
|
||||||
|
|
||||||
|
<!-- Allow long lines -->
|
||||||
|
<rule ref="Generic.Files.LineLength.TooLong">
|
||||||
|
<exclude-pattern>templates</exclude-pattern>
|
||||||
|
</rule>
|
||||||
|
|
||||||
|
<!-- Ignore indentation rules -->
|
||||||
|
<rule ref="Generic.WhiteSpace.ScopeIndent">
|
||||||
|
<exclude-pattern>templates</exclude-pattern>
|
||||||
|
</rule>
|
||||||
|
|
||||||
|
<!-- Allow PHP closing tags -->
|
||||||
|
<rule ref="PSR2.Files.ClosingTag.NotAllowed">
|
||||||
|
<exclude-pattern>templates</exclude-pattern>
|
||||||
|
</rule>
|
||||||
</ruleset>
|
</ruleset>
|
||||||
|
|||||||
Reference in New Issue
Block a user