Repository navigation
Expand file tree
/
Copy pathphpcs.xml
More file actions
81 lines (64 loc) · 3.09 KB
/
Copy pathphpcs.xml
File metadata and controls
81 lines (64 loc) · 3.09 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
<?xml version="1.0"?>
<ruleset name="PHP_CodeSniffer configuration">
<!-- See https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml -->
<!-- See https://github.com/PHPCompatibility/PHPCompatibilityWP -->
<description>A custom set of code standard rules to check for WordPress Theme based on PRS12</description>
<!--
#############################################################################
CONFIGS
#############################################################################
-->
<!-- PHP version uses at PHPCompatibility -->
<config name="testVersion" value="8.4-"/>
<!--
#############################################################################
COMMAND LINE ARGUMENTS
https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml
#############################################################################
-->
<!-- Pass some flags to PHPCS:
p flag: Show progress of the run.
s flag: Show sniff codes in all reports.
-->
<arg value="ps"/>
<!-- Strip the file paths down to the relevant bit. -->
<arg name="basepath" value="./"/>
<!-- Check up to 8 files simultaneously. -->
<arg name="parallel" value="8"/>
<!-- Only check the PHP files. -->
<arg name="extensions" value="php"/>
<arg name="colors"/>
<!--<arg name="report" value="code"/>-->
<!--<arg name="report" value="summary"/>-->
<!-- Check all files in this directory and the directories below it. -->
<file>.</file>
<!-- Exclude patterns. -->
<exclude-pattern>*/vendor/*</exclude-pattern>
<exclude-pattern>*/vendor-custom/*</exclude-pattern>
<exclude-pattern>*/node_modules/*</exclude-pattern>
<exclude-pattern>.git/*</exclude-pattern>
<exclude-pattern>.github/*</exclude-pattern>
<!-- Snippet fragments are merge instructions, not standalone files: top-level side effects, no
namespace/ABSPATH guard, never loaded as-is. The rest of stubs/ is real PHP copied verbatim
into the theme root during conversion, so it stays linted (must pass composer lint). -->
<exclude-pattern>*/stubs/*.snippet.php</exclude-pattern>
<!-- Custom sniff tooling, not theme code - not scanned against theme style rules. -->
<exclude-pattern>*/.phpcs/*</exclude-pattern>
<!--
#############################################################################
RULES
#############################################################################
-->
<!-- Include the PSR-1 standard -->
<!-- https://www.php-fig.org/psr/psr-1/#23-side-effects Excluding Side Effects in the PHP class file for defined('ABSPATH') || exit; -->
<rule ref="PSR1">
<exclude name="PSR1.Files.SideEffects.FoundWithSymbols"/>
</rule>
<!-- Include the whole PSR-12 standard -->
<rule ref="PSR12"/>
<!-- Use PHPCompatibilityWP standard -->
<rule ref="PHPCompatibilityWP"/>
<!-- Disallow alternative (colon) control-structure syntax (if/endif, foreach/endforeach, ...)
- required by stubs/classic-theme/CONVERT.md's brace-syntax rule for classic templates. -->
<rule ref="./.phpcs/StarterKitStandard/Sniffs/ControlStructures/DisallowAlternativeSyntaxSniff.php"/>
</ruleset>