Repository navigation
Expand file tree
/
Copy pathphpcs.xml.dist
More file actions
122 lines (106 loc) · 4.35 KB
/
Copy pathphpcs.xml.dist
File metadata and controls
122 lines (106 loc) · 4.35 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
<?xml version="1.0"?>
<ruleset name="Starter Blocks Theme">
<description>PHPCS ruleset for the Starter Blocks theme.</description>
<!-- Scan the theme root by default. -->
<file>./</file>
<!-- Exclude generated, vendored, and runtime content. -->
<exclude-pattern>*/vendor/*</exclude-pattern>
<exclude-pattern>*/node_modules/*</exclude-pattern>
<exclude-pattern>*/dist/*</exclude-pattern>
<exclude-pattern>*/build/*</exclude-pattern>
<exclude-pattern>*/languages/*</exclude-pattern>
<exclude-pattern>*/src/public/*</exclude-pattern>
<!--
LearnDash template overrides: the markup, its strings and its text domain
are LearnDash's, copied in so the surrounding layout can be adjusted. Held
to the plugin's conventions, not the theme's.
-->
<exclude-pattern>*/learndash/*</exclude-pattern>
<!-- PHP files only. -->
<arg name="extensions" value="php"/>
<!-- Output: progress + sniff codes, colors. -->
<arg value="ps"/>
<arg name="colors"/>
<!-- Cache for performance on repeat runs. -->
<arg name="cache" value=".phpcs-cache"/>
<!-- Run sniffs in parallel where possible. -->
<arg name="parallel" value="8"/>
<!--
Use the WordPress-Extra ruleset: Core formatting + best-practices
(escaping, security, deprecated functions). Does NOT include the
DocBlock-pedantry rules from WordPress-Docs.
-->
<rule ref="WordPress-Extra">
<!-- Theme partials and templates don't follow class-{name}.php naming. -->
<exclude name="WordPress.Files.FileName"/>
<!-- Allow short ternary `?:`. -->
<exclude name="Universal.Operators.DisallowShortTernary"/>
<!-- Don't enforce Yoda conditions. -->
<exclude name="WordPress.PHP.YodaConditions"/>
</rule>
<!-- Tell the i18n sniff which text-domain is valid for this theme. -->
<rule ref="WordPress.WP.I18n">
<properties>
<property name="text_domain" type="array">
<element value="fj-blocks"/>
</property>
</properties>
</rule>
<!--
sb_image_block() builds canonical core/image markup with every value run
through esc_url()/esc_attr() internally, so its return is already safe to
echo. Declare it auto-escaped so `echo sb_image_block( … )` in patterns
doesn't trip the output-escaping sniff.
-->
<rule ref="WordPress.Security.EscapeOutput">
<properties>
<property name="customAutoEscapedFunctions" type="array">
<element value="sb_image_block"/>
</property>
</properties>
</rule>
<!-- Declare the prefix used by theme global functions. -->
<rule ref="WordPress.NamingConventions.PrefixAllGlobals">
<properties>
<property name="prefixes" type="array">
<element value="sb"/>
</property>
</properties>
<!-- "sb" is the theme's deliberate short namespace; allow it while keeping
the rest of the prefix enforcement. -->
<exclude name="WordPress.NamingConventions.PrefixAllGlobals.ShortPrefixPassed"/>
</rule>
<!-- Targets the "deprecated since" checks. -->
<config name="minimum_supported_wp_version" value="6.5"/>
<!--
scripts/ holds WP-CLI tooling run via `wp eval-file`, never loaded by
WordPress. Its `echo` is a terminal message, not page output, so the escaping
and i18n sniffs don't apply — escaping a status line would corrupt it, and a
CLI tool has no translations.
Excluded per sniff rather than by file, so everything else still applies:
an undefined variable or a deprecated call in these scripts is a real bug
and should still be reported.
-->
<rule ref="WordPress.Security.EscapeOutput">
<exclude-pattern>*/scripts/*</exclude-pattern>
</rule>
<rule ref="WordPress.WP.I18n">
<exclude-pattern>*/scripts/*</exclude-pattern>
</rule>
<!--
Same reason for the filesystem sniff: WP_Filesystem is not bootstrapped in a
`wp eval-file` context, and these scripts read and write local working files,
never a remote resource.
-->
<rule ref="WordPress.WP.AlternativeFunctions">
<exclude-pattern>*/scripts/*</exclude-pattern>
</rule>
<!--
The prefix sniff is excluded here for a different reason: these scripts are
shared tooling with their own `sb_` namespace, identical across every theme.
A theme's prefix convention describes the theme's own globals.
-->
<rule ref="WordPress.NamingConventions.PrefixAllGlobals">
<exclude-pattern>*/scripts/*</exclude-pattern>
</rule>
</ruleset>