-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathphpcs.xml.dist
More file actions
47 lines (40 loc) · 2.04 KB
/
phpcs.xml.dist
File metadata and controls
47 lines (40 loc) · 2.04 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
<?xml version="1.0"?>
<ruleset name="CDCF">
<description>
PHP_CodeSniffer configuration for the CDCF WordPress plugin and theme.
Codacy detects this file at the repo root and uses it INSTEAD of its
default coding standard for this repository's PHP analysis. The
config is intentionally minimal:
1. Codacy's default standard bundles file-inclusion sniffs (e.g.
"Avoid Including Files Dynamically" and "Avoid insecure file
inclusion") that flag `require_once __DIR__ . '/...'` — the
canonical WordPress plugin entry-loading pattern — as though
the path operand were user-controlled. Both operands are
compile-time constants (a magic constant and a string literal),
so the pattern is safe by inspection. Pulling in PSR12 or a
similar full standard would replace the noise with a different
kind of noise (camelCase function naming, line-length, doc-block
requirements that don't match WordPress plugin conventions).
2. The three Generic sniffs below are universal good practice and
do not conflict with WordPress: Unix line endings, no PHP short
open tags, and no error-silencing `@` operator.
To add stricter checks later, prefer per-rule `<rule ref="Generic.X.Y" />`
over `<rule ref="PSR12" />` so the WP-friendly function/file
conventions remain valid.
</description>
<!-- Analyse only the plugin and theme PHP under wordpress/. -->
<file>wordpress/plugins/cdcf-redis-translations</file>
<file>wordpress/themes/cdcf-headless</file>
<!-- Exclude infrastructure paths PHPCS shouldn't touch. -->
<exclude-pattern>*/vendor/*</exclude-pattern>
<exclude-pattern>*/tests/*</exclude-pattern>
<exclude-pattern>*/.phpunit.cache/*</exclude-pattern>
<!-- Minimum-signal sniffs that don't conflict with WP plugin idioms. -->
<rule ref="Generic.Files.LineEndings">
<properties>
<property name="eolChar" value="\n" />
</properties>
</rule>
<rule ref="Generic.PHP.DisallowShortOpenTag" />
<rule ref="Generic.PHP.NoSilencedErrors" />
</ruleset>