Skip to content

Commit

Permalink
Use phpcs.xml for all 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 c5f3724 commit 246955c
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 48 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,4 @@ install:
script:
- npm run build
- phpcs --report=summary
- phpcs --report=summary --standard=phpcs-templates.xml -n
- phpmd src text cleancode,codesize,controversial,design,naming,unusedcode
43 changes: 0 additions & 43 deletions phpcs-templates.xml

This file was deleted.

47 changes: 44 additions & 3 deletions phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
<description>Roots Coding Standards</description>

<!-- Scan these files -->
<file>functions.php</file>
<file>src</file>
<file>templates</file>
<file>functions.php</file>
<file>src</file>

<!-- Show colors in console -->
<arg value="-colors"/>
Expand All @@ -14,7 +15,47 @@

<!-- Use PSR-2 as a base -->
<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"/>
</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>
2 changes: 1 addition & 1 deletion src/filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @link https://codex.wordpress.org/Conditional_Tags
*/
add_filter('sage/display_sidebar', function ($display) {
// The sidebar will NOT be displayed if ANY of the following return true
// The sidebar will NOT be displayed if ANY of the following return true
return $display ? !in_array(true, [
is_404(),
is_front_page(),
Expand Down

0 comments on commit 246955c

Please sign in to comment.