-
Notifications
You must be signed in to change notification settings - Fork 79
/
Copy pathphpcs.xml
125 lines (101 loc) · 4.64 KB
/
phpcs.xml
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<?xml version="1.0"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Freemius WordPress SDK"
xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/squizlabs/PHP_CodeSniffer/master/phpcs.xsd">
<description>A custom set of rules to check for a WPized WordPress project</description>
<!--
#############################################################################
COMMAND LINE ARGUMENTS
https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-Ruleset
#############################################################################
-->
<file>.</file>
<!-- Exclude the Composer Vendor directory. -->
<exclude-pattern>/vendor/*</exclude-pattern>
<!-- Exclude the Node Modules directory. -->
<exclude-pattern>/node_modules/*</exclude-pattern>
<!-- Exclude front-end asset files. -->
<exclude-pattern>/assets/*</exclude-pattern>
<!-- Exclude language files. -->
<exclude-pattern>/languages/*</exclude-pattern>
<exclude-pattern>/includes/class-freemius.php</exclude-pattern>
<!-- Strip the filepaths down to the relevant bit. -->
<arg name="basepath" value="."/>
<!-- Check up to 8 files simultaneously. -->
<arg name="parallel" value="8"/>
<arg name="extensions" value="php"/>
<arg name="tab-width" value="4"/>
<!--
#############################################################################
SET UP THE RULESETS
#############################################################################
-->
<!-- Include only the security related sniffs for now -->
<rule ref="WordPress.Security.EscapeOutput">
<properties>
<property name="customEscapingFunctions" type="array">
<element value="fs_html_get_attributes"/>
<element value="fs_html_get_classname"/>
<element value="fs_html_get_sanitized_html"/>
<element value="fs_esc_attr"/>
<element value="fs_esc_attr_inline"/>
<element value="fs_esc_attr_x_inline"/>
<element value="htmlspecialchars"/>
<element value="fs_esc_html_inline"/>
</property>
<property name="customAutoEscapedFunctions" type="array">
<element value="fs_nonce_url" />
<element value="WP_FS__ADDRESS" />
</property>
</properties>
</rule>
<!-- Encourage use of wp_safe_redirect() to avoid open redirect vulnerabilities.
https://github.com/WordPress/WordPress-Coding-Standards/pull/1264 -->
<rule ref="WordPress.Security.SafeRedirect"/>
<!-- Verify that a nonce check is done before using values in superglobals.
https://github.com/WordPress/WordPress-Coding-Standards/issues/73 -->
<rule ref="WordPress.Security.NonceVerification">
<properties>
<property name="customNonceVerificationFunctions" type="array">
<element value="check_ajax_referer"/>
</property>
</properties>
</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.CodeAnalysis.UnusedFunctionParameter"/>-->
<!-- <rule ref="Generic.Commenting.Todo"/>-->
<!-- Check for PHP cross-version compatibility. -->
<!--
To enable this, the PHPCompatibilityWP standard needs
to be installed.
See the readme for installation instructions:
https://github.com/PHPCompatibility/PHPCompatibilityWP
For more information, also see:
https://github.com/PHPCompatibility/PHPCompatibility
-->
<!-- <rule ref="PHPCompatibilityWP"/> -->
<config name="testVersion" value="5.6-"/>
<rule ref="PHPCompatibility"/>
<!--
#############################################################################
SNIFF SPECIFIC CONFIGURATION
#############################################################################
-->
<!--
To get the optimal benefits of using WPCS, we should add a couple of
custom properties.
Adjust the values of these properties to fit our needs.
For information on additional custom properties available, check out
the wiki:
https://github.com/WordPress/WordPress-Coding-Standards/wiki/Customizable-sniff-properties
-->
<config name="minimum_supported_wp_version" value="5.0"/>
<rule ref="WordPress.NamingConventions.PrefixAllGlobals">
<properties>
<property name="prefixes" type="array">
<element value="fs"/>
</property>
</properties>
</rule>
</ruleset>