-
Notifications
You must be signed in to change notification settings - Fork 385
/
phpcs.xml
126 lines (112 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
126
<?xml version="1.0"?>
<ruleset name="WordPress Coding Standards for AMP">
<!-- Exclude libraries that are meant to be externalized -->
<exclude-pattern>lib/*</exclude-pattern>
<rule ref="WordPress-Core">
<exclude name="Generic.Arrays.DisallowShortArraySyntax" />
<exclude name="WordPress.PHP.DisallowShortTernary" />
</rule>
<rule ref="WordPress-Docs">
<exclude-pattern>tests/*</exclude-pattern>
</rule>
<rule ref="WordPress-Extra" />
<rule ref="WordPress.WP.I18n">
<properties>
<property name="text_domain" type="array">
<element value="amp"/>
<element value="default"/>
</property>
</properties>
</rule>
<rule ref="WordPress.Files.FileName.InvalidClassFileName">
<exclude-pattern>tests/*</exclude-pattern>
<exclude-pattern>src/*</exclude-pattern>
<exclude-pattern>includes/admin/class-amp-customizer.php</exclude-pattern>
<exclude-pattern>includes/embeds/class-amp-dailymotion-embed.php</exclude-pattern>
<exclude-pattern>includes/embeds/class-amp-facebook-embed.php</exclude-pattern>
<exclude-pattern>includes/embeds/class-amp-gallery-embed.php</exclude-pattern>
<exclude-pattern>includes/embeds/class-amp-instagram-embed.php</exclude-pattern>
<exclude-pattern>includes/embeds/class-amp-pinterest-embed.php</exclude-pattern>
<exclude-pattern>includes/embeds/class-amp-soundcloud-embed.php</exclude-pattern>
<exclude-pattern>includes/embeds/class-amp-twitter-embed.php</exclude-pattern>
<exclude-pattern>includes/embeds/class-amp-vimeo-embed.php</exclude-pattern>
<exclude-pattern>includes/embeds/class-amp-vine-embed.php</exclude-pattern>
</rule>
<rule ref="WordPress.Arrays.MultipleStatementAlignment.LongIndexSpaceBeforeDoubleArrow">
<exclude-pattern>tests/test-tag-and-attribute-sanitizer.php</exclude-pattern>
</rule>
<rule ref="WordPress.Arrays.MultipleStatementAlignment.DoubleArrowNotAligned">
<exclude-pattern>tests/test-tag-and-attribute-sanitizer.php</exclude-pattern>
</rule>
<rule ref="WordPress.WP.AlternativeFunctions">
<exclude-pattern>bin/*</exclude-pattern>
</rule>
<rule ref="WordPress.WP.EnqueuedResources">
<exclude-pattern>includes/actions/class-amp-paired-post-actions.php</exclude-pattern>
</rule>
<rule ref="WordPress.Files.FileName.NotHyphenatedLowercase">
<exclude-pattern>src/*</exclude-pattern>
<exclude-pattern>includes/templates/single-amp_story.php</exclude-pattern>
</rule>
<rule ref="WordPress.NamingConventions.ValidVariableName">
<properties>
<property name="customPropertiesWhitelist" type="array">
<element value="childNodes"/>
<element value="tagName"/>
<element value="textContent"/>
<element value="parentNode"/>
<element value="nodeType"/>
<element value="nodeName"/>
<element value="nextSibling"/>
<element value="previousSibling"/>
<element value="firstChild"/>
<element value="lastChild"/>
<element value="nodeValue"/>
<element value="DEFAULT_ARGS"/>
<element value="documentElement"/>
<element value="removeChild"/>
<element value="ownerDocument"/>
<element value="DEFAULT_WIDTH"/>
<element value="DEFAULT_HEIGHT"/>
</property>
</properties>
</rule>
<!-- Prevent false positives for translator comments by adjusting the threshold for commented out code. -->
<rule ref="Squiz.PHP.CommentedOutCode">
<properties>
<property name="maxPercentage" value="50" />
</properties>
</rule>
<!-- Enforce PascalCase file names in src/ only. -->
<rule ref="Squiz.Classes.ClassFileName">
<include-pattern>src/*</include-pattern>
</rule>
<!-- Include sniffs for PHP cross-version compatibility. -->
<config name="testVersion" value="5.6-"/>
<rule ref="PHPCompatibilityWP">
<exclude-pattern>bin/*</exclude-pattern>
</rule>
<rule ref="Generic.Arrays.DisallowLongArraySyntax.Found">
<exclude-pattern>amp.php</exclude-pattern>
</rule>
<rule ref="VariableAnalysis.CodeAnalysis.VariableAnalysis">
<exclude-pattern>templates/*</exclude-pattern>
<exclude-pattern>includes/templates/*</exclude-pattern>
<exclude-pattern>back-compat/*</exclude-pattern>
<properties>
<property name="allowUnusedParametersBeforeUsed" value="true"/>
</properties>
</rule>
<arg value="s"/>
<arg name="extensions" value="php"/>
<file>.</file>
<!-- Strip the filepaths down to the relevant bit. -->
<arg name="basepath" value="./"/>
<!-- Check up to 20 files simultaneously. -->
<arg name="parallel" value="20"/>
<exclude-pattern>*/node_modules/*</exclude-pattern>
<exclude-pattern>*/vendor/*</exclude-pattern>
<exclude-pattern type="relative">^build/*</exclude-pattern>
<exclude-pattern>includes/sanitizers/class-amp-allowed-tags-generated.php</exclude-pattern>
<exclude-pattern>assets/js/*.asset.php</exclude-pattern>
</ruleset>