-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathphpcs.xml
80 lines (66 loc) · 4 KB
/
phpcs.xml
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
<?xml version="1.0"?>
<ruleset name="Code-Snippets">
<config name="installed_paths" value="vendor/wp-coding-standards/wpcs" />
<!-- See https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml -->
<!-- See https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/blob/develop/WordPress/ruleset.xml -->
<!-- Include the WordPress ruleset, with exclusions. -->
<rule ref="WordPress">
<!-- I like to have a newline after closing brace, sometimes -->
<exclude name="Squiz.ControlStructures.ControlSignature.SpaceAfterCloseBrace" />
<!-- allow hooks containing forward slashes -->
<exclude name="WordPress.NamingConventions.ValidHookName.UseUnderscores" />
<!-- I can manage this -->
<exclude name="WordPress.WP.I18n.UnorderedPlaceholders" />
<exclude name="Generic.Formatting.MultipleStatementAlignment.NotSameWarning" />
<exclude name="PEAR.Functions.FunctionCallSignature.MultipleArguments" />
<exclude name="Generic.WhiteSpace.ScopeIndent.IncorrectExact" />
<exclude name="Squiz.PHP.Eval.Discouraged" />
<exclude name="PEAR.Functions.FunctionCallSignature.CloseBracketLine" />
<exclude name="WordPress.Arrays.ArrayDeclarationSpacing.AssociativeArrayFound" />
<exclude name="PSR2.ControlStructures.SwitchDeclaration.BodyOnNextLineCASE" />
<exclude name="WordPress.WhiteSpace.ControlStructureSpacing.BlankLineAfterEnd" />
<exclude name="WordPress.Arrays.ArrayDeclarationSpacing.ArrayItemNoNewLine" />
<exclude name="WordPress.CodeAnalysis.AssignmentInCondition.Found" />
<exclude name="Squiz.PHP.DisallowMultipleAssignments.FoundInControlStructure" />
<!--<exclude name="WordPress.PHP.DevelopmentFunctions.error_log_trigger_error" />-->
<!--<exclude name="WordPress.DB.DirectDatabaseQuery.DirectQuery" />-->
<!-- this is useful for certain templates -->
<exclude name="Squiz.PHP.EmbeddedPhp.ContentBeforeOpen" />
<exclude name="Squiz.PHP.EmbeddedPhp.ContentAfterOpen" />
<exclude name="Squiz.PHP.EmbeddedPhp.ContentBeforeEnd" />
<exclude name="Squiz.PHP.EmbeddedPhp.ContentAfterEnd" />
<exclude name="PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket" />
<!-- database table names should be interpolated -->
<exclude name="WordPress.WP.PreparedSQL.NotPrepared" />
<!-- this picks up a lot of false positives -->
<exclude name="WordPress.DB.PreparedSQL.NotPrepared" />
<exclude name="WordPress.DB.PreparedSQL.InterpolatedNotPrepared" />
<exclude name="WordPress.DB.PreparedSQLPlaceholders.UnfinishedPrepare" />
<exclude name="WordPress.DB.PreparedSQL.InterpolatedNotPrepared" />
<!-- this does not account for variable type comments -->
<exclude name="Generic.Commenting.DocComment.MissingShort" />
<!-- this disallows assignment inside conditional statements -->
<exclude name="WordPress.CodeAnalysis.AssignmentInCondition.Found" />
<exclude name="Squiz.PHP.DisallowMultipleAssignments.Found" />
<!-- this does not always need to happen -->
<exclude name="WordPress.Arrays.MultipleStatementAlignment.DoubleArrowNotAligned" />
<!-- what's wrong with smart tabs? -->
<exclude name="WordPress.WhiteSpace.PrecisionAlignment.Found" />
<exclude name="Generic.WhiteSpace.DisallowSpaceIndent.SpacesUsed" />
<!-- this is a useful feature -->
<exclude name="Generic.PHP.DisallowShortOpenTag.EchoFound" />
<!-- seems unnecessary -->
<exclude name="Squiz.Commenting.InlineComment.InvalidEndChar" />
<!-- todo -->
<exclude name="WordPress.Security.NonceVerification.Recommended" />
<exclude name="WordPress.Security.NonceVerification.Missing" />
<exclude name="WordPress.Security.SafeRedirect.wp_redirect_wp_redirect" />
<exclude name="WordPress.Security.ValidatedSanitizedInput.InputNotSanitized" />
<exclude name="WordPress.Security.ValidatedSanitizedInput.InputNotValidated" />
<exclude name="WordPress.Security.ValidatedSanitizedInput.MissingUnslash" />
</rule>
<!-- class files don't need an additional file comment -->
<rule ref="Squiz.Commenting.FileComment.Missing">
<exclude-pattern>class-*\.php$</exclude-pattern>
</rule>
</ruleset>