Skip to content

Instantly share code, notes, and snippets.

@marcimat marcimat/phpcs.xml forked from kent1D/phpcs.xml
Last active May 17, 2019

Embed
What would you like to do?
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 type="relative">^/config/*</exclude-pattern>
<exclude-pattern type="relative">^/IMG/*</exclude-pattern>
<exclude-pattern type="relative">^/lib/*</exclude-pattern>
<exclude-pattern type="relative">^/local/*</exclude-pattern>
<exclude-pattern type="relative">^/plugins/*</exclude-pattern>
<exclude-pattern type="relative">^/squelettes/*</exclude-pattern>
<exclude-pattern type="relative">^/tmp/*</exclude-pattern>
<exclude-pattern>*/lang/*</exclude-pattern>
<exclude-pattern>*/branches/*</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" />
<!-- Désactiver les camel caps sur les fonctions -->
<exclude name="Generic.NamingConventions.CamelCapsFunctionName" />
<!-- Désactiver mauvaise la vérification sur les if (\n multilignes ) -->
<exclude name="PSR2.ControlStructures.ControlStructureSpacing.SpacingAfterOpenBrace"/>
<!-- Désactiver la vérification du SideEffect : le test sur _ECRIRE_INC_VERSION le choppe tout le temps -->
<exclude name="PSR1.Files.SideEffects"/>
</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>
@marcimat

This comment has been minimized.

Copy link
Owner Author

marcimat commented Sep 18, 2017

J’ai modifié pour pouvoir utiliser le fichier en dehors de la racine SPIP, par exemple dans un plugin, lorsqu’on est dans plugins/xx/.
phpcs --standard=../../spipcs.xml -v .
Les fichiers étaient ignorés car la règle d’exclusion plugins/* s’appliquait.
J’ai ignoré certaines autres règles.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.