Skip to content

Commit 8ef98e3

Browse files
committed
Add phpcs.xml
1 parent 837f053 commit 8ef98e3

File tree

2 files changed

+92
-2
lines changed

2 files changed

+92
-2
lines changed

includes/enqueues.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*/
1313
\add_action(
1414
'enqueue_block_editor_assets',
15-
function() {
15+
function () {
1616
// Variations.
1717
$variations_assets_file = BUILD_DIR_PATH . 'variations.asset.php';
1818

@@ -28,6 +28,5 @@ function() {
2828
// Allow for translation.
2929
wp_set_script_translations( 'advanced-query-loop', 'advanced-query-loop' );
3030
}
31-
3231
}
3332
);

phpcs.xml

+91
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="WordPress Coding Standards for my twitch streams">
3+
<description>A base ruleset that all other 10up rulesets should extend.</description>
4+
5+
<exclude-pattern>*/phpunit.xml*</exclude-pattern>
6+
<exclude-pattern>*/dist/*</exclude-pattern>
7+
<exclude-pattern>*/languages/*</exclude-pattern>
8+
9+
<!-- Third-party code -->
10+
<exclude-pattern>*/bower-components/*</exclude-pattern>
11+
<exclude-pattern>*/node_modules/*</exclude-pattern>
12+
<exclude-pattern>*/vendor/*</exclude-pattern>
13+
14+
<!-- Ensure certain file types aren't sniffed -->
15+
<exclude-pattern>*\.(css|js)</exclude-pattern>
16+
17+
<!-- Don't worry about files that don't contain any code -->
18+
<rule ref="Internal.NoCodeFound">
19+
<severity>0</severity>
20+
</rule>
21+
22+
<!-- Ignore mixed line-endings warnings -->
23+
<rule ref="Internal.LineEndings.Mixed">
24+
<severity>0</severity>
25+
</rule>
26+
27+
<!-- Internal exceptions (often occur on minified files) -->
28+
<rule ref="Internal.Tokenizer.Exception">
29+
<severity>0</severity>
30+
</rule>
31+
32+
<!-- For CI, don't fail on warnings -->
33+
<config name="ignore_warnings_on_exit" value="1"/>
34+
35+
<!-- Enforce doc standards -->
36+
<rule ref="WordPress-Docs">
37+
<!-- Don't worry about capitalizing long lines -->
38+
<exclude name="Generic.Commenting.DocComment.LongNotCapital"/>
39+
40+
<!-- Dont need to capitalize first letter -->
41+
<exclude name="Generic.Commenting.DocComment.ShortNotCapital"/>
42+
</rule>
43+
44+
<rule ref="WordPress-Extra">
45+
<!-- Forget about file names -->
46+
<exclude name="WordPress.Files.FileName"/>
47+
48+
<!-- Allow same line control structures e.g. if ( true ) { echo 1; } -->
49+
<exclude name="Squiz.ControlStructures.ControlSignature.NewlineAfterOpenBrace"/>
50+
51+
<!-- Don't require punctuation after inline comments -->
52+
<exclude name="Squiz.Commenting.InlineComment.InvalidEndChar"/>
53+
54+
<!-- Allow empty catch statements -->
55+
<exclude name="Generic.CodeAnalysis.EmptyStatement.DetectedCatch"/>
56+
57+
<!-- Comment punctuation doesn't matter -->
58+
<exclude name="Squiz.Commenting.FunctionComment.ParamCommentFullStop"/>
59+
<exclude name="Squiz.Commenting.FunctionComment.ThrowsNoFullStop"/>
60+
<exclude name="Squiz.Commenting.FunctionComment.Missing"/>
61+
62+
<!-- Package tags are annoying-->
63+
<exclude name="Squiz.Commenting.FileComment.MissingPackageTag"/>
64+
65+
<!-- Allow shorthand array syntax -->
66+
<exclude name="Generic.Arrays.DisallowShortArraySyntax.Found"/>
67+
68+
<!-- Allow WP global modification -->
69+
<exclude name="WordPress.WP.GlobalVariablesOverride.Prohibited"/>
70+
71+
<!-- This nonce sniff almost never works right -->
72+
<exclude name="WordPress.Security.NonceVerification.Missing"/>
73+
</rule>
74+
75+
<!-- Sets the minimum supported WP version to 4.7, which is over a year old. -->
76+
<config name="minimum_supported_wp_version" value="4.7" />
77+
78+
<!-- Make missing translator comment a warning. -->
79+
<rule ref="WordPress.WP.I18n.MissingTranslatorsComment">
80+
<type>warning</type>
81+
</rule>
82+
83+
<!-- Sometimes we need to override globals -->
84+
<rule ref="WordPress.WP.GlobalVariablesOverride.OverrideProhibited">
85+
<type>warning</type>
86+
</rule>
87+
88+
<!-- PHP version check. -->
89+
<config name="testVersion" value="8.1-"/>
90+
91+
</ruleset>

0 commit comments

Comments
 (0)