forked from Yoast/wordpress-seo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathphpcs.xml.dist
More file actions
139 lines (126 loc) · 6.19 KB
/
phpcs.xml.dist
File metadata and controls
139 lines (126 loc) · 6.19 KB
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<?xml version="1.0"?>
<ruleset name="Yoast SEO">
<description>Yoast SEO rules for PHP_CodeSniffer</description>
<file>.</file>
<exclude-pattern>tests/*</exclude-pattern>
<exclude-pattern>vendor/*</exclude-pattern>
<exclude-pattern>vendor_prefixed/*</exclude-pattern>
<exclude-pattern>node_modules/*</exclude-pattern>
<exclude-pattern>deprecated/*</exclude-pattern>
<exclude-pattern>languages/*</exclude-pattern>
<exclude-pattern>artifact/*</exclude-pattern>
<exclude-pattern>.wordpress-svn/*</exclude-pattern>
<exclude-pattern>config/php-scoper/*</exclude-pattern>
<exclude-pattern>src/generated/*</exclude-pattern>
<arg name="extensions" value="php"/>
<arg value="sp"/>
<rule ref="Yoast">
<exclude name="WordPress.WP.PreparedSQL.NotPrepared"/><!-- TODO audit raw queries -->
<exclude name="WordPress.Functions.DontExtract" /><!-- TODO audit usage & replace -->
<exclude name="Squiz.Commenting.FunctionCommentThrowTag.WrongNumber" /><!-- TODO Remove this once we're on 0.5. See https://github.com/squizlabs/PHP_CodeSniffer/issues/650 for more info. -->
</rule>
<!-- Exclude migrations folder from filename checks, as we do not have control over this format -->
<rule ref="WordPress.Files.FileName.UnderscoresNotAllowed">
<exclude-pattern>migrations/*</exclude-pattern>
</rule>
<rule ref="Generic.Files.LowercasedFilename.NotFound">
<exclude-pattern>migrations/*</exclude-pattern>
</rule>
<!-- /Exclude migrations folder -->
<rule ref="WordPress.WP.I18n">
<properties>
<property name="text_domain" value="wordpress-seo"/>
</properties>
</rule>
<rule ref="WordPress.NamingConventions.ValidVariableName">
<properties>
<property name="customVariablesWhitelist" type="array" value="pageUrl,responseCode,siteEntry,siteUrl,countPerTypes,urlCrawlErrorSample,buyUrl,infoUrl" />
</properties>
</rule>
<!-- TEMPORARY exclusion! This has to do with a bug in WPCS 0.10.0. The bug has been fixed in WPCS 0.11.0. -->
<rule ref="WordPress.WP.I18n.UnorderedPlaceholders">
<exclude-pattern>inc/class-wpseo-replace-vars.php</exclude-pattern>
</rule>
<!-- TEMPORARY exclusion! Because we're not on 0.5 yet -->
<rule ref="WordPress.VIP.RestrictedFunctions">
<exclude-pattern>inc/class-wpseo-image-utils.php</exclude-pattern>
</rule>
<!--
#############################################################################
SNIFF FOR PHP CROSS-VERSION COMPATIBILITY
#############################################################################
-->
<config name="testVersion" value="5.2-"/>
<rule ref="PHPCompatibilityWP"/>
<!-- WP-CLI and src (indexables) have a minimum PHP requirement of PHP 5.6. -->
<rule ref="PHPCompatibility.LanguageConstructs.NewLanguageConstructs.t_ns_separatorFound">
<exclude-pattern>*/cli/class-cli-*\.php$</exclude-pattern>
<exclude-pattern>*/src/*.php$</exclude-pattern>
<exclude-pattern>*/migrations/*.php$</exclude-pattern>
<exclude-pattern>*/config/*.php$</exclude-pattern>
</rule>
<rule ref="PHPCompatibility.Keywords.NewKeywords.t_useFound">
<exclude-pattern>*/cli/class-cli-*\.php$</exclude-pattern>
<exclude-pattern>*/src/*.php$</exclude-pattern>
<exclude-pattern>*/migrations/*.php$</exclude-pattern>
<exclude-pattern>*/config/*.php$</exclude-pattern>
</rule>
<rule ref="PHPCompatibility.Keywords.NewKeywords.t_dirFound">
<exclude-pattern>*/src/*.php$</exclude-pattern>
<exclude-pattern>*/config/*.php$</exclude-pattern>
</rule>
<rule ref="PHPCompatibility.Keywords.NewKeywords.t_traitFound">
<exclude-pattern>*/src/*.php$</exclude-pattern>
</rule>
<rule ref="PHPCompatibility.FunctionUse.NewFunctionParameters.spl_autoload_register_prependFound">
<exclude-pattern>*/src/*.php$</exclude-pattern>
<exclude-pattern>*/config/*.php$</exclude-pattern>
</rule>
<rule ref="PHPCompatibility.FunctionNameRestrictions.NewMagicMethods.__invokeFound">
<exclude-pattern>*/src/*.php$</exclude-pattern>
</rule>
<rule ref="PHPCompatibility.Classes.NewLateStaticBinding.Found">
<exclude-pattern>*/src/*.php$</exclude-pattern>
</rule>
<rule ref="PHPCompatibility.Keywords.NewKeywords.t_namespaceFound">
<exclude-pattern>*/src/*.php$</exclude-pattern>
<exclude-pattern>*/config/*.php$</exclude-pattern>
</rule>
<rule ref="PHPCompatibility.FunctionUse.NewFunctions.get_called_classFound">
<exclude-pattern>*/src/*.php$</exclude-pattern>
</rule>
<rule ref="PHPCompatibility.Syntax.NewDynamicAccessToStatic.Found">
<exclude-pattern>*/src/*.php$</exclude-pattern>
</rule>
<rule ref="PHPCompatibility.FunctionDeclarations.NewClosure.Found">
<exclude-pattern>*/src/*.php$</exclude-pattern>
<exclude-pattern>*/config/*.php$</exclude-pattern>
</rule>
<rule ref="PHPCompatibility.Syntax.NewShortArray.Found">
<exclude-pattern>*/src/*.php$</exclude-pattern>
<exclude-pattern>*/config/*.php$</exclude-pattern>
</rule>
<rule ref="PHPCompatibility.Syntax.NewFunctionArrayDereferencing.Found">
<exclude-pattern>*/src/*.php$</exclude-pattern>
</rule>
<rule ref="PHPCompatibility.FunctionUse.NewFunctions.class_aliasFound">
<exclude-pattern>*/src/*.php$</exclude-pattern>
</rule>
<rule ref="PHPCompatibility.Constants.NewMagicClassConstant.Found">
<exclude-pattern>*/src/*.php$</exclude-pattern>
<exclude-pattern>*/config/*.php$</exclude-pattern>
</rule>
<!-- These usages of PHP > 5.2 code are surrounded by the correct safeguards. -->
<rule ref="PHPCompatibility.FunctionUse.NewFunctionParameters.parse_ini_file_scanner_modeFound">
<exclude-pattern>*/admin/import/class-import-settings\.php$</exclude-pattern>
</rule>
<rule ref="PHPCompatibility.Constants.NewConstants.ini_scanner_rawFound">
<exclude-pattern>*/admin/import/class-import-settings\.php$</exclude-pattern>
</rule>
<rule ref="PHPCompatibility.FunctionUse.NewFunctionParameters.http_build_query_enc_typeFound">
<exclude-pattern>*/inc/sitemaps/class-sitemaps-renderer\.php$</exclude-pattern>
</rule>
<rule ref="PHPCompatibility.FunctionUse.NewFunctionParameters.array_unique_sort_flagsFound">
<exclude-pattern>*/inc/sitemaps/class-sitemap-image-parser\.php$</exclude-pattern>
</rule>
</ruleset>