-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy path.phpcs.xml.dist
111 lines (94 loc) · 4.36 KB
/
.phpcs.xml.dist
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<?xml version="1.0"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="WooCommerce POS" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/squizlabs/PHP_CodeSniffer/master/phpcs.xsd">
<!-- See https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml -->
<!-- See https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards -->
<!-- See https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/blob/develop/WordPress-Core/ruleset.xml -->
<description>Starting Point Rule Set.</description>
<!-- What to scan -->
<file>vendor/autoload.php</file>
<file>woocommerce-pos.php</file>
<file>includes/</file>
<!-- sniff PHP -->
<arg name="extensions" value="php/PHP"/>
<!-- Show sniff codes in all reports, and progress when running -->
<arg value="snp"/>
<arg name="colors"/>
<arg name="basepath" value="."/>
<arg name="parallel" value="20"/>
<!-- Exclude paths -->
<exclude-pattern>*/dev/*</exclude-pattern>
<exclude-pattern>*/node_modules/*</exclude-pattern>
<exclude-pattern>*/local-config\.php</exclude-pattern>
<exclude-pattern>*/vendor/*</exclude-pattern>
<config name="minimum_supported_wp_version" value="5.2.2"/>
<!-- @see https://github.com/PHPCompatibility/PHPCompatibility#using-a-custom-ruleset -->
<config name="testVersion" value="7.3-"/>
<!-- @see https://github.com/PHPCompatibility/PHPCompatibilityWP#how-to-use -->
<rule ref="PHPCompatibilityWP"/>
<!-- Include the WordPress-Extra standard. -->
<!-- @see https://github.com/WordPress/WordPress-Coding-Standards -->
<rule ref="WordPress-Extra">
<!--
We may want a middle ground though. The best way to do this is add the
entire ruleset, then rule by rule, remove ones that don't suit a project.
We can do this by running `phpcs` with the '-s' flag, which allows us to
see the names of the sniffs reporting errors.
Once we know the sniff names, we can opt to exclude sniffs which don't
suit our project like so.
The below two examples just show how you can exclude rules/error codes.
They are not intended as advice about which sniffs to exclude.
-->
<!-- <exclude-pattern>*/js/*</exclude-pattern>
<exclude name="Generic.Commenting"/>
<exclude name="Generic.PHP.DisallowShortOpenTag.EchoFound"/>
<exclude name="Generic.WhiteSpace.DisallowSpaceIndent.SpacesUsed"/>
<exclude name="PEAR.Functions.FunctionCallSignature.CloseBracketLine"/>
<exclude name="PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket"/>
<exclude name="PEAR.Functions.FunctionCallSignature.MultipleArguments"/>
<exclude name="PEAR.Functions.FunctionCallSignature.OpeningIndent"/>
<exclude name="Squiz.Commenting"/>
<exclude name="Squiz.WhiteSpace.SuperfluousWhitespace.EndLine"/>
<exclude name="WordPress.Files.FileName.InvalidClassFileName"/>
<exclude name="WordPress.Files.FileName.NotHyphenatedLowercase"/>
<exclude name="WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid"/>
<exclude name="WordPress.NamingConventions.ValidHookName.UseUnderscores"/>
<exclude name="WordPress.Variables.GlobalVariables.OverrideProhibited"/> -->
</rule>
<!-- Let's also check that everything is properly documented. -->
<rule ref="WordPress-Docs"/>
<!-- Add in some extra rules from other standards. -->
<rule ref="Generic.Commenting.Todo"/>
<!-- wp_verify_nonce() handles casting on it's own and does not need extra overhead -->
<rule ref="WordPress.Security.ValidatedSanitizedInput">
<properties>
<property name="customUnslashingSanitizingFunctions" type="array">
<element value="wp_verify_nonce"/>
</property>
</properties>
</rule>
<rule ref="WordPress.Files.FileName">
<properties>
<property name="strict_class_file_names" value="false"/>
</properties>
<exclude name="WordPress.Files.FileName.NotHyphenatedLowercase"/>
</rule>
<rule ref="WordPress.NamingConventions.PrefixAllGlobals">
<properties>
<property name="prefixes" type="array">
<element value="woocommerce_pos_"/>
<element value="WCPOS\WooCommercePOS"/>
</property>
</properties>
</rule>
<!-- Translations -->
<rule ref="WordPress.WP.I18n">
<properties>
<property name="text_domain" type="array">
<element value="woocommerce-pos"/>
<!-- Sometimes I piggy back on WooCommerce & WordPress translations -->
<element value="woocommerce"/>
<element value="wordpress"/>
</property>
</properties>
</rule>
</ruleset>