Skip to content
This repository was archived by the owner on Jul 7, 2025. It is now read-only.

Commit d537449

Browse files
init
0 parents  commit d537449

File tree

2 files changed

+133
-0
lines changed

2 files changed

+133
-0
lines changed

Neuralab/ruleset.xml

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="Neuralab">
3+
<description>a.neuralab.coding-standard</description>
4+
5+
<!-- We'll use spaces for indentation! -->
6+
<rule ref="Generic.WhiteSpace.DisallowTabIndent" />
7+
8+
<rule ref="WordPress-Core">
9+
10+
<!-- Allow space indent! -->
11+
<exclude name="Generic.WhiteSpace.DisallowSpaceIndent" />
12+
13+
<!-- We like short arrays. -->
14+
<exclude name="Generic.Arrays.DisallowShortArraySyntax" />
15+
<rule ref="Generic.Arrays.DisallowLongArraySyntax" />
16+
17+
<!-- It's fine. -->
18+
<exclude name="Squiz.PHP.EmbeddedPhp.NoSemicolon" />
19+
20+
<exclude name="WordPress.WhiteSpace.PrecisionAlignment" />
21+
22+
<!-- Exclude other conflicting rules. -->
23+
<exclude name="WordPress.Arrays.MultipleStatementAlignment.DoubleArrowNotAligned" />
24+
<exclude name="WordPress.PHP.DevelopmentFunctions.error_log_trigger_error" />
25+
<exclude name="Generic.Formatting.MultipleStatementAlignment.NotSameWarning" />
26+
27+
<!-- Yoda, say no to. -->
28+
<exclude name="WordPress.PHP.YodaConditions" />
29+
</rule>
30+
<rule ref="Generic.WhiteSpace.DisallowTabIndent" />
31+
<rule ref="PEAR.Functions.FunctionCallSignature">
32+
<properties>
33+
<property name="indent" value="2"/>
34+
</properties>
35+
</rule>
36+
<!-- Whitespace - indent with 2 spaces, dissalow tabs -->
37+
<rule ref="Generic.WhiteSpace.ScopeIndent">
38+
<properties>
39+
<property name="indent" value="2"/>
40+
<property name="exact" value="true"/>
41+
<property name="tabIndent" value="false"/>
42+
<property name="ignoreIndentationTokens" type="array" value="T_HEREDOC,T_NOWDOC,T_INLINE_HTML"/>
43+
</properties>
44+
</rule>
45+
46+
<!-- set switch indent to 2 instead of 4 -->
47+
<rule ref="PSR2.ControlStructures.SwitchDeclaration">
48+
<properties>
49+
<property name="indent" value="2"/>
50+
</properties>
51+
</rule>
52+
53+
54+
55+
<!-- Prefer alignment over line length. -->
56+
<rule ref="WordPress.Arrays.MultipleStatementAlignment">
57+
<properties>
58+
<property name="maxColumn" value="1000" />
59+
</properties>
60+
</rule>
61+
62+
<rule ref="WordPress.DB.SlowDBQuery" />
63+
64+
<!-- Allow . in hook names. -->
65+
<rule ref="WordPress.NamingConventions.ValidHookName">
66+
<properties>
67+
<property name="additionalWordDelimiters" value="." />
68+
</properties>
69+
</rule>
70+
71+
<rule ref="WordPress.Security.EscapeOutput" />
72+
73+
<rule ref="WordPress.Security.PluginMenuSlug" />
74+
<rule ref="WordPress.Security.PluginMenuSlug.Using__FILE__">
75+
<type>error</type>
76+
</rule>
77+
78+
<!-- Allow the use of filesystem functions. -->
79+
<rule ref="WordPress.WP.AlternativeFunctions">
80+
<properties>
81+
<property name="exclude" value="file_get_contents,file_system_read" />
82+
<property name="exclude" value="json_encode,json_decode" />
83+
</properties>
84+
</rule>
85+
86+
<rule ref="WordPress.WP.CronInterval" />
87+
<rule ref="WordPress.WP.CronInterval.CronSchedulesInterval">
88+
<type>error</type>
89+
<message>Scheduling crons at %s sec ( less than %s minutes ) is prohibited.</message>
90+
</rule>
91+
92+
<rule ref="WordPress.WP.PostsPerPage" />
93+
<rule ref="WordPress.WP.PostsPerPage.posts_per_page_numberposts">
94+
<type>error</type>
95+
</rule>
96+
<rule ref="WordPress.WP.PostsPerPage.posts_per_page_posts_per_page">
97+
<type>error</type>
98+
</rule>
99+
<rule ref="PEAR.Functions.FunctionCallSignature">
100+
<properties>
101+
<property name="allowMultipleArguments" value="true"/>
102+
</properties>
103+
</rule>
104+
<rule ref="PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket">
105+
<severity phpcs-only="true">0</severity>
106+
</rule>
107+
<rule ref="PEAR.Functions.FunctionCallSignature.CloseBracketLine">
108+
<severity phpcs-only="true">0</severity>
109+
</rule>
110+
111+
<!-- Single statement per line. -->
112+
<rule ref="Generic.Formatting.DisallowMultipleStatements" />
113+
114+
<!-- Declare symbols or run code, but not both. -->
115+
<rule ref="PSR1.Files.SideEffects" />
116+
117+
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace">
118+
<exclude name="Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines" />
119+
</rule>
120+
</ruleset>

composer.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "neuralab/coding-standards",
3+
"description": "Neuralab coding standards",
4+
"type": "phpcodesniffer-standard",
5+
"license": "GPL-2.0-or-later",
6+
"require": {
7+
"php": ">=7.1",
8+
"wp-coding-standards/wpcs": "2.2.1",
9+
"automattic/vipwpcs": "2.0.0",
10+
"squizlabs/php_codesniffer": "~3.5.4",
11+
"dealerdirect/phpcodesniffer-composer-installer": "^0.6.2"
12+
}
13+
}

0 commit comments

Comments
 (0)