-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathphpcs.xml
More file actions
87 lines (70 loc) · 2.73 KB
/
phpcs.xml
File metadata and controls
87 lines (70 loc) · 2.73 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
<?xml version="1.0"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="PostGrid Coding Standards" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/squizlabs/PHP_CodeSniffer/master/phpcs.xsd">
<description>PostGrid plugin coding standards based on WordPress Coding Standards</description>
<!-- Scan only PHP files -->
<arg name="extensions" value="php"/>
<!-- Show progress and sniff codes -->
<arg value="ps"/>
<!-- Check up to 8 files simultaneously -->
<arg name="parallel" value="8"/>
<!-- Set minimum supported WordPress version -->
<config name="minimum_supported_wp_version" value="6.0"/>
<!-- Set minimum supported PHP version -->
<config name="testVersion" value="7.4-"/>
<!-- Files to check -->
<file>.</file>
<!-- Exclude paths -->
<exclude-pattern>/vendor/*</exclude-pattern>
<exclude-pattern>/node_modules/*</exclude-pattern>
<exclude-pattern>/tests/*</exclude-pattern>
<exclude-pattern>/build/*</exclude-pattern>
<exclude-pattern>/dist/*</exclude-pattern>
<exclude-pattern>*.min.js</exclude-pattern>
<exclude-pattern>*.min.css</exclude-pattern>
<!-- Include the WordPress ruleset -->
<rule ref="WordPress">
<!-- Allow short array syntax -->
<exclude name="Generic.Arrays.DisallowShortArraySyntax"/>
<!-- We use PSR-4 autoloading, so file names don't follow WP convention -->
<exclude name="WordPress.Files.FileName.InvalidClassFileName"/>
<exclude name="WordPress.Files.FileName.NotHyphenatedLowercase"/>
</rule>
<!-- Include WordPress-Extra ruleset -->
<rule ref="WordPress-Extra">
<!-- Allow multiple statements per line in switch cases -->
<exclude name="Generic.Formatting.DisallowMultipleStatements.SameLine"/>
</rule>
<!-- Include WordPress-Docs ruleset -->
<rule ref="WordPress-Docs"/>
<!-- Check for PHP cross-version compatibility -->
<rule ref="PHPCompatibilityWP"/>
<!-- Enforce PSR-4 autoloading standard -->
<rule ref="PSR4">
<properties>
<property name="basePath" value="."/>
</properties>
</rule>
<!-- Security rules -->
<rule ref="WordPress.Security.EscapeOutput"/>
<rule ref="WordPress.Security.NonceVerification"/>
<rule ref="WordPress.Security.ValidatedSanitizedInput"/>
<!-- Enforce proper text domain -->
<rule ref="WordPress.WP.I18n">
<properties>
<property name="text_domain" type="array">
<element value="postgrid"/>
</property>
</properties>
</rule>
<!-- Allow some flexibility for modern PHP -->
<rule ref="WordPress.PHP.DisallowShortTernary.Found">
<severity>0</severity>
</rule>
<!-- Custom line length for better readability -->
<rule ref="Generic.Files.LineLength">
<properties>
<property name="lineLimit" value="120"/>
<property name="absoluteLineLimit" value="150"/>
</properties>
</rule>
</ruleset>