Repository navigation
Expand file tree
/
Copy pathphpcs.xml
More file actions
101 lines (89 loc) · 3.72 KB
/
Copy pathphpcs.xml
File metadata and controls
101 lines (89 loc) · 3.72 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
<?xml version="1.0"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
name="Ceros"
xsi:noNamespaceSchemaLocation="https://schema.phpcodesniffer.com/phpcs.xsd">
<description>Coding standards for the Ceros WordPress plugin.</description>
<!-- Hand-written PHP only. -->
<file>ceros.php</file>
<file>includes</file>
<file>src</file>
<file>tests</file>
<!-- `build/` is wp-scripts output, `vendor/` is Composer's. -->
<exclude-pattern>*/build/*</exclude-pattern>
<exclude-pattern>*/node_modules/*</exclude-pattern>
<exclude-pattern>*/vendor/*</exclude-pattern>
<!-- CLI defaults, so `composer lint` needs no arguments. -->
<arg name="extensions" value="php"/>
<arg name="basepath" value="."/>
<arg name="parallel" value="8"/>
<arg name="colors"/>
<!-- s: show the sniff name on every message, so it can be fixed or excluded. -->
<arg value="sp"/>
<!-- Core + Docs + Extra. -->
<rule ref="WordPress">
<!-- WPCS mandates long `array()`; this plugin has used short `[ … ]`
consistently since it was written. Keeping the existing style is
worth more than matching upstream on a purely cosmetic point. -->
<exclude name="Universal.Arrays.DisallowShortArraySyntax"/>
</rule>
<!-- Flag translator calls that use the wrong text domain. -->
<rule ref="WordPress.WP.I18n">
<properties>
<property name="text_domain" type="array">
<element value="ceros"/>
</property>
</properties>
</rule>
<!-- Every global must carry a plugin prefix, so nothing can collide with
another plugin or with core. -->
<rule ref="WordPress.NamingConventions.PrefixAllGlobals">
<properties>
<property name="prefixes" type="array">
<element value="ceros"/>
<element value="Ceros_"/>
<element value="CEROS_"/>
</property>
</properties>
<!-- The unit bootstrap defines WordPress's own names on purpose. -->
<exclude-pattern>tests/bootstrap.php</exclude-pattern>
</rule>
<!-- A PHPUnit method name is its description, and an annotation-only docblock
(@dataProvider, @covers) is idiomatic. Satisfying these would mean a
prose sentence on every one. -->
<rule ref="Generic.Commenting.DocComment">
<exclude-pattern>tests/*</exclude-pattern>
</rule>
<rule ref="Squiz.Commenting.FunctionComment.Missing">
<exclude-pattern>tests/*</exclude-pattern>
</rule>
<rule ref="Squiz.Commenting.ClassComment.Missing">
<exclude-pattern>tests/*</exclude-pattern>
</rule>
<rule ref="Squiz.Commenting.FunctionComment.MissingParamTag">
<exclude-pattern>tests/*</exclude-pattern>
</rule>
<!-- The bootstrap's shims must keep WordPress's signatures, so some params
go unused, and wp_parse_url() is implemented with parse_url() by
definition. -->
<rule ref="Generic.CodeAnalysis.UnusedFunctionParameter">
<exclude-pattern>tests/bootstrap.php</exclude-pattern>
</rule>
<rule ref="WordPress.WP.AlternativeFunctions.parse_url_parse_url">
<exclude-pattern>tests/bootstrap.php</exclude-pattern>
</rule>
<!-- The crypto tests take apart the base64 envelope Ceros_Encryption stores,
to tamper with the nonce and ciphertext. Transport encoding, as in the
class itself, not obfuscation. -->
<rule ref="WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_encode">
<exclude-pattern>tests/unit/EncryptionTest.php</exclude-pattern>
</rule>
<rule ref="WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_decode">
<exclude-pattern>tests/unit/EncryptionTest.php</exclude-pattern>
</rule>
<!-- Must match "Requires at least" in ceros.php / readme.txt. -->
<config name="minimum_wp_version" value="6.7"/>
<!-- Syntax/functions unavailable on the oldest PHP we support
("Requires PHP: 7.4"). -->
<config name="testVersion" value="7.4-"/>
<rule ref="PHPCompatibilityWP"/>
</ruleset>