-
Notifications
You must be signed in to change notification settings - Fork 99
Expand file tree
/
Copy pathphpcs.xml
More file actions
88 lines (72 loc) · 3.27 KB
/
phpcs.xml
File metadata and controls
88 lines (72 loc) · 3.27 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
<?xml version="1.0"?>
<ruleset
name="Fieldmanager"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/squizlabs/PHP_CodeSniffer/master/phpcs.xsd"
>
<description>Sniffs for the coding standards of the Fieldmanager plugin</description>
<!-- Include Alley Rules -->
<rule ref="Alley-Interactive">
<!-- See #659. -->
<exclude name="Generic.Arrays.DisallowLongArraySyntax" />
<exclude name="Generic.Files.OneObjectStructurePerFile" />
<!--
The project uses an established `fm_` prefix convention which is 3 characters,
below the 4-character minimum required by PrefixAllGlobals. Short prefix entries
are discarded by the sniff regardless of whether ShortPrefixPassed is suppressed,
so all fm_* / FM_* globals are flagged as unprefixed. Since renaming would be a
breaking API change, suppress the NonPrefixed* sub-rules here.
-->
<exclude name="WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound" />
<exclude name="WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound" />
<exclude name="WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedConstantFound" />
<exclude name="WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound" />
<exclude name="WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound" />
<!--
Several files intentionally define helper functions alongside class declarations
(e.g. deprecated template-tag wrappers, singleton helpers). Exclude the rule that
requires functions and OO declarations to be in separate files.
-->
<exclude name="Universal.Files.SeparateFunctionsFromOO.Mixed" />
</rule>
<arg value="ps" />
<!-- Whenever possible, cache the scan results and re-use those for unchanged files on the next scan. -->
<arg name="cache" value=".phpcs/cache.json" />
<!-- Strip the filepaths down to the relevant bit. -->
<arg name="basepath" value="./" />
<!-- Check up to 20 files simultaneously. -->
<arg name="parallel" value="20" />
<!-- Set severity to 1 to see everything that isn't effectively turned off. -->
<arg name="severity" value="1" />
<!-- Exclude the vendor directories. -->
<exclude-pattern>php/libraries/</exclude-pattern>
<exclude-pattern>vendor/</exclude-pattern>
<!-- The version set here matches the minimum version tested in .github/workflows/phpunit.yml. -->
<config name="minimum_supported_wp_version" value="5.8" />
<file>fieldmanager.php</file>
<file>php/</file>
<file>templates/</file>
<rule ref="WordPress.WP.I18n">
<properties>
<property name="text_domain" value="fieldmanager" />
</properties>
</rule>
<rule ref="WordPress.NamingConventions.PrefixAllGlobals">
<properties>
<property name="prefixes" type="array">
<element value="fm_" />
<element value="_fm" />
<element value="fieldmanager" />
<element value="_fieldmanager" />
<element value="Fieldmanager" />
</property>
</properties>
</rule>
<rule ref="WordPress.Files.FileName.InvalidClassFileName">
<exclude-pattern>fieldmanager.php</exclude-pattern>
</rule>
<rule ref="Squiz.Commenting.FileComment.SpacingAfterComment">
<!-- Allow templates to put closing PHP tags immediately after the file header. -->
<exclude-pattern>templates/</exclude-pattern>
</rule>
</ruleset>