Skip to content

Commit bf30ced

Browse files
committed
developers loves rules
0 parents  commit bf30ced

File tree

2 files changed

+64
-0
lines changed

2 files changed

+64
-0
lines changed

codeat.xml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="Codeat">
3+
<description>Codeat coding standard.</description>
4+
5+
<exclude name="Squiz.Commenting.FileComment.SpacingAfterOpen" />
6+
<exclude name="Squiz.PHP.DisallowMultipleAssignments.Found"/>
7+
<rule ref="PHPDoc"/>
8+
9+
<rule ref="WordPress">
10+
<exclude name="Generic.Files.LineEndings.InvalidEOLChar" />
11+
<exclude name="Generic.Commenting.DocComment.MissingShort" />
12+
<exclude name="Generic.PHP.Syntax" />
13+
<exclude name="Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines" />
14+
<exclude name="Squiz.Commenting.FileComment.SpacingAfterOpen"/>
15+
<exclude name="PEAR.Functions.FunctionCallSignature.Indent" />
16+
<exclude name="WordPress.Arrays.ArrayKeySpacingRestrictions.NoSpacesAroundArrayKeys" />
17+
<exclude name="WordPress.Arrays.ArrayKeySpacingRestrictions.SpacesAroundArrayKeys" />
18+
<exclude name="WordPress.Files.FileName.InvalidClassFileName"/>
19+
<exclude name="WordPress.Files.FileName.NotHyphenatedLowercase"/>
20+
<exclude name="WordPress.VIP.DirectDatabaseQuery" />
21+
<exclude name="WordPress.VIP.FileSystemWritesDisallow"/>
22+
<exclude name="WordPress.VIP.ValidatedSanitizedInput"/>
23+
<exclude name="WordPress.XSS.EscapeOutput" />
24+
<exclude name="WordPress.PHP.YodaConditions"/>
25+
<exclude name="WordPress.Variables.GlobalVariables"/>
26+
<exclude name="WordPress.WP.I18n.NonSingularStringLiteralDomain"/>
27+
<exclude name="WordPress.WhiteSpace.OperatorSpacing.NoSpaceAfter" />
28+
<exclude name="WordPress.Arrays.ArrayDeclaration.NoComma" />
29+
<exclude name="WordPress.CSRF.NonceVerification.NoNonceVerification"/>
30+
</rule>
31+
32+
<rule ref="WordPress.VIP.RestrictedFunctions">
33+
<properties>
34+
<property name="exclude" value="file_get_contents,curl" />
35+
</properties>
36+
</rule>
37+
38+
<rule ref="Wordpress-Docs">
39+
<exclude name="Squiz.Commenting.InlineComment.InvalidEndChar" />
40+
</rule>
41+
42+
</ruleset>

readme.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Codeat Coding Standards
2+
3+
CodeatCS is a project with rulsetes used for the Codeat plugins/themes development based on [YoastCS](https://github.com/Yoast/yoastcs/).
4+
5+
## PHP Code Sniffer
6+
7+
Set of [PHP Code Sniffer](https://github.com/squizlabs/PHP_CodeSniffer) rules.
8+
9+
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).
11+
12+
### How to disable rules
13+
14+
```phpcs --standard=/path/CodeatCS/codeat.xml ./file.php -s```
15+
16+
The `-s` parameter print after the comment of the rules what is the name.
17+
18+
### PhpStorm
19+
20+
Refer to [Using PHP Code Sniffer Tool](https://www.jetbrains.com/phpstorm/help/using-php-code-sniffer-tool.html) in PhpStorm documentation.
21+
22+
After installation `Yoast` standard will be available as a choice in PHP Code Sniffer Validation inspection.

0 commit comments

Comments
 (0)