Skip to content

Instantly share code, notes, and snippets.

@brunob
Created December 8, 2015 19:57
Show Gist options
  • Save brunob/c92c9b7bfec67aadc149 to your computer and use it in GitHub Desktop.
Save brunob/c92c9b7bfec67aadc149 to your computer and use it in GitHub Desktop.
PHP_CodeSniffer pour SPIP
<?xml version="1.0"?>
<ruleset name="SPIP">
<!--
Liens utiles
https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards
https://github.com/ucfcdl/fuelphp-phpcs/tree/master/Standards/FuelPHP
https://github.com/vanilla/addons/tree/master/standards/Vanilla
-->
<description>Coding rules for SPIP</description>
<exclude-pattern>config/*</exclude-pattern>
<exclude-pattern>IMG/*</exclude-pattern>
<exclude-pattern>lib/*</exclude-pattern>
<exclude-pattern>local/*</exclude-pattern>
<exclude-pattern>plugins/*</exclude-pattern>
<exclude-pattern>squelettes/*</exclude-pattern>
<exclude-pattern>tmp/*</exclude-pattern>
<!-- Appliquer PSR-2 moins nos exceptions -->
<rule ref="PSR2" >
<!-- Désactiver la vérification sur les noms de classes/fonctions -->
<exclude name="Squiz.Classes.ValidClassName" />
<!-- Désactiver la vérification sur l'indentation -->
<exclude name="Generic.WhiteSpace.ScopeIndent" />
<exclude name="Generic.WhiteSpace.DisallowTabIndent" />
<!-- Désactiver la vérification sur les accolades -->
<exclude name="Squiz.Functions.MultiLineFunctionDeclaration.BraceOnSameLine" />
<exclude name="PSR2.Classes.ClassDeclaration.OpenBraceNewLine" />
<exclude name="PSR2.Classes.PropertyDeclaration" />
</rule>
<!-- Tabulations pour l'indentation -->
<arg name="tab-width" value="4"/>
<rule ref="Generic.WhiteSpace.DisallowSpaceIndent"/>
<rule ref="Generic.WhiteSpace.ScopeIndent">
<properties>
<property name="indent" value="4"/>
<property name="tabIndent" value="true"/>
</properties>
</rule>
<!-- Accolades -->
<rule ref="Generic.Functions.OpeningFunctionBraceKernighanRitchie"/>
<rule ref="Generic.ControlStructures.InlineControlStructure" />
<rule ref="Squiz.ControlStructures.ControlSignature" />
<rule ref="Squiz.ControlStructures.ControlSignature.NewlineAfterOpenBrace">
<severity>0</severity>
</rule>
<!-- Guillemets doubles -->
<rule ref="Squiz.Strings.DoubleQuoteUsage"/>
<rule ref="Squiz.Strings.DoubleQuoteUsage.ContainsVar">
<severity>0</severity>
</rule>
<!-- Constantes en majuscules -->
<rule ref="Generic.NamingConventions.UpperCaseConstantName"/>
</ruleset>
@kent1D
Copy link

kent1D commented May 11, 2016

C'est nul on ne peut pas faire de pull request sur les gist ;)

J'ai ajouté deux petites choses ici
<exclude-pattern>branches/*</exclude-pattern> si on utilise sur une racine de plugin

<exclude name="Generic.NamingConventions.CamelCapsFunctionName" /> pour certaines fonctions de classes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment