Skip to content

Commit 28f6fd2

Browse files
committed
new version
1 parent 7a6b06c commit 28f6fd2

File tree

4 files changed

+60
-92
lines changed

4 files changed

+60
-92
lines changed

codeat.xml

Lines changed: 59 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
11
<?xml version="1.0"?>
22
<ruleset name="Codeat">
33
<description>Codeat coding standard.</description>
4+
<!-- Only check PHP files. -->
5+
<arg name="extensions" value="php"/>
46

7+
<!-- Treat all files as UTF-8. -->
8+
<config name="encoding" value="utf-8"/>
9+
10+
<!-- Show progress. -->
11+
<arg value="p"/>
12+
13+
<exclude-pattern type="relative">^\.git/*</exclude-pattern>
514
<exclude-pattern>/vendor/*</exclude-pattern>
615
<exclude-pattern>/node_modules/*</exclude-pattern>
716
<exclude-pattern>freemius</exclude-pattern>
8-
<exclude-pattern>/lib/</exclude-pattern>
917
<exclude-pattern>*test*</exclude-pattern>
1018
<exclude-pattern>index.php</exclude-pattern>
11-
<exclude-pattern>CMB2</exclude-pattern>
1219

1320
<!-- Include some specific sniffs -->
1421
<rule ref="Generic.CodeAnalysis.EmptyStatement"/>
@@ -23,6 +30,11 @@
2330
<rule ref="Generic.Commenting.DocComment.SpacingBeforeShort"/>
2431
<rule ref="Generic.Commenting.DocComment.ContentBeforeClose"/>
2532

33+
<!-- Check for PHP Parse errors. -->
34+
<rule ref="Generic.PHP.Syntax"/>
35+
<!-- Check for file encoding problems. -->
36+
<rule ref="Generic.Files.ByteOrderMark"/>
37+
2638
<rule ref="Squiz.Commenting">
2739
<exclude name="Squiz.Commenting.FileComment.WrongStyle" />
2840
<exclude name="Squiz.Commenting.FileComment.SpacingAfterOpen" />
@@ -102,7 +114,6 @@
102114
<exclude name="WordPress.XSS.EscapeOutput" />
103115
<exclude name="WordPress.PHP.YodaConditions"/>
104116
<exclude name="WordPress.Arrays.ArrayIndentation.ItemNotAligned" />
105-
<exclude name="WordPress.PHP.DevelopmentFunctions.error_log_error_log" />
106117
<exclude name="WordPress.Variables.GlobalVariables"/>
107118
<exclude name="WordPress.WP.I18n.NonSingularStringLiteralDomain"/>
108119
<exclude name="WordPress.WhiteSpace.OperatorSpacing.NoSpaceAfter" />
@@ -113,30 +124,71 @@
113124
<exclude name="WordPress.Classes.ClassInstantiation.MissingParenthesis" />
114125
</rule>
115126

127+
<rule ref="WordPress.PHP.StrictInArray"/>
128+
<rule ref="WordPress.DB.PreparedSQLPlaceholders"/>
129+
<rule ref="WordPress.CodeAnalysis.EmptyStatement"/>
130+
<rule ref="Generic.CodeAnalysis.ForLoopWithTestFunctionCall"/>
131+
<rule ref="Generic.CodeAnalysis.UnconditionalIfStatement"/>
132+
<rule ref="WordPress.DB.RestrictedFunctions"/>
133+
<rule ref="WordPress.DB.RestrictedClasses"/>
134+
<rule ref="WordPress.PHP.DevelopmentFunctions"/>
135+
<rule ref="WordPress.PHP.DiscouragedPHPFunctions"/>
136+
<rule ref="WordPress.WP.AlternativeFunctions"/>
137+
<rule ref="WordPress.WP.DiscouragedConstants"/>
138+
<rule ref="WordPress.WP.DiscouragedFunctions"/>
139+
<rule ref="WordPress.WP.EnqueuedResources"/>
140+
<rule ref="WordPress.NamingConventions.PrefixAllGlobals"/>
141+
116142
<rule ref="Wordpress-Docs">
117143
<exclude name="Squiz.Commenting.InlineComment.InvalidEndChar" />
118144
</rule>
119145

120146
<rule ref="WordPress.WP.DeprecatedClasses">
121147
<properties>
122-
<property name="minimum_supported_version" value="4.6"/>
148+
<property name="minimum_supported_version" value="4.7"/>
123149
</properties>
124150
</rule>
125151

126-
127152
<rule ref="WordPress.WP.DeprecatedFunctions">
128153
<properties>
129-
<property name="minimum_supported_version" value="4.6"/>
154+
<property name="minimum_supported_version" value="4.7"/>
130155
</properties>
131156
</rule>
132157

133158
<rule ref="WordPress.WP.DeprecatedParameters">
134159
<properties>
135-
<property name="minimum_supported_version" value="4.6"/>
160+
<property name="minimum_supported_version" value="4.7"/>
136161
</properties>
137162
</rule>
138163

164+
<rule ref="WordPress.Functions.DontExtract">
165+
<type>warning</type>
166+
</rule>
167+
<!-- Prepare all SQL queries. -->
168+
<rule ref="WordPress.WP.PreparedSQL">
169+
<type>warning</type>
170+
</rule>
139171

172+
<!-- Escape all non-hard-coded output. -->
173+
<rule ref="WordPress.XSS.EscapeOutput">
174+
<type>warning</type>
175+
</rule>
176+
<!-- Verify that a nonce check is done before using values in superglobals. -->
177+
<rule ref="WordPress.CSRF.NonceVerification">
178+
<type>warning</type>
179+
</rule>
180+
181+
<!-- Superglobal input not validated or sanitized. -->
182+
<rule ref="WordPress.VIP.ValidatedSanitizedInput">
183+
<type>warning</type>
184+
</rule>
185+
186+
<rule ref="Generic.CodeAnalysis.EmptyStatement">
187+
<type>warning</type>
188+
</rule>
189+
<rule ref="Squiz.PHP.DisallowSizeFunctionsInLoops">
190+
<type>warning</type>
191+
</rule>
140192
<rule ref="WordPress.WP.I18n">
141193
<properties>
142194
<property name="text_domain" type="array" value="glossary,woo-fiscalita-italiana,genesis"/>

config.phpcs

Lines changed: 0 additions & 37 deletions
This file was deleted.

format.xml

Lines changed: 0 additions & 42 deletions
This file was deleted.

readme.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
# Codeat Coding Standards
22

3-
CodeatCS is a project with rulsetes used for the Codeat plugins/themes development based on [YoastCS](https://github.com/Yoast/yoastcs/).
3+
CodeatCS is a project with rulsetes used for the Codeat plugins/themes development based on [YoastCS](https://github.com/Yoast/yoastcs/) and [https://github.com/jrfnl/QA-WP-Projects/](https://github.com/jrfnl/QA-WP-Projects/).
44

55
## PHP Code Sniffer
66

77
Set of [PHP Code Sniffer](https://github.com/squizlabs/PHP_CodeSniffer) rules.
88

99
Based on [WordPress Coding Standards](https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards) project, implementing official [WordPress PHP Coding Standards](https://make.wordpress.org/core/handbook/coding-standards/php/).
10-
Require also a set of string rules for [PHPDoc](https://github.com/CodeAtCode/PHPDoc-for-PHPCS-PHPCBF).
1110

1211
### How to disable rules
1312

@@ -20,7 +19,3 @@ The `-s` parameter print after the comment of the rules what is the name.
2019
Refer to [Using PHP Code Sniffer Tool](https://www.jetbrains.com/phpstorm/help/using-php-code-sniffer-tool.html) in PhpStorm documentation.
2120

2221
After installation `Yoast` standard will be available as a choice in PHP Code Sniffer Validation inspection.
23-
24-
## PHPMD
25-
26-
Rules used: codesize, design, unused

0 commit comments

Comments
 (0)