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

Commit 68760c9

Browse files
add silent
1 parent 75fb8fc commit 68760c9

File tree

4 files changed

+42
-110
lines changed

4 files changed

+42
-110
lines changed

Neuralab Empty/ruleset.xml

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
/** Just a test to confirm the coding standard is loaded */
3+
4+
use PHP_CodeSniffer\Sniffs\Sniff;
5+
use PHP_CodeSniffer\Files\File;
6+
7+
class SilentFallbackSniff implements Sniff
8+
{
9+
public function register()
10+
{
11+
return array(T_COMMENT);
12+
}
13+
14+
public function process(File $phpcsFile, $stackPtr)
15+
{
16+
$tokens = $phpcsFile->getTokens();
17+
if (substr( $tokens[$stackPtr]['content'], 0, 9 ) === '#neuralab') {
18+
$warn = 'Neuralab silent linter is working; found %s';
19+
$data = array(trim($tokens[$stackPtr]['content']));
20+
$phpcsFile->addWarning($warn, $stackPtr, 'Found', $data);
21+
}
22+
}
23+
}

Neuralab-Silent/ruleset.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="Neuralab Silent">
3+
<description>a.neuralab.coding-standard</description>
4+
<rule ref="Squiz.PHP.Eval.Discouraged">
5+
<type>error</type>
6+
<message>Please, don't use eval()</message>
7+
</rule>
8+
</ruleset>

Neuralab/ruleset.xml

Lines changed: 11 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -1,110 +1,15 @@
11
<?xml version="1.0"?>
22
<ruleset name="Neuralab">
33
<description>a.neuralab.coding-standard</description>
4-
<!-- We'll use spaces for indentation! -->
5-
<rule ref="Generic.WhiteSpace.DisallowTabIndent" />
6-
<rule ref="WordPress-Core">
7-
<!-- Allow space indent! -->
8-
<exclude name="Generic.WhiteSpace.DisallowSpaceIndent" />
9-
<!-- We like short arrays. -->
10-
<exclude name="Generic.Arrays.DisallowShortArraySyntax" />
11-
<rule ref="Generic.Arrays.DisallowLongArraySyntax" />
12-
<!-- It's fine. -->
13-
<exclude name="Squiz.PHP.EmbeddedPhp.NoSemicolon" />
14-
<exclude name="WordPress.WhiteSpace.PrecisionAlignment" />
15-
<exclude name="WordPress.Security.EscapeOutput.OutputNotEscaped" />
16-
<!-- override tab width -->
17-
<exclude name="WordPress.Arrays.ArrayIndentation"/>
18-
<rule ref="WordPress.Arrays.ArrayIndentation">
19-
<properties>
20-
<property name="tab-width" value="2"/>
21-
</properties>
22-
</rule>
23-
<!-- Exclude other conflicting rules. -->
24-
<exclude name="WordPress.Arrays.MultipleStatementAlignment.DoubleArrowNotAligned" />
25-
<exclude name="WordPress.PHP.DevelopmentFunctions.error_log_trigger_error" />
26-
<exclude name="Generic.Formatting.MultipleStatementAlignment.NotSameWarning" />
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-
<!-- set switch indent to 2 instead of 4 -->
46-
<rule ref="PSR2.ControlStructures.SwitchDeclaration">
47-
<properties>
48-
<property name="indent" value="2"/>
49-
</properties>
50-
</rule>
51-
<!-- Prefer alignment over line length. -->
52-
<rule ref="WordPress.Arrays.MultipleStatementAlignment">
53-
<properties>
54-
<property name="maxColumn" value="1000" />
55-
</properties>
56-
</rule>
57-
<rule ref="WordPress.DB.SlowDBQuery" />
58-
<!-- Allow . in hook names. -->
59-
<rule ref="WordPress.NamingConventions.ValidHookName">
60-
<properties>
61-
<property name="additionalWordDelimiters" value="." />
62-
</properties>
63-
</rule>
64-
<rule ref="WordPress.Security.EscapeOutput" />
65-
<rule ref="WordPress.Security.PluginMenuSlug" />
66-
<rule ref="WordPress.Security.PluginMenuSlug.Using__FILE__">
67-
<type>error</type>
68-
</rule>
69-
<!-- Allow the use of filesystem functions. -->
70-
<rule ref="WordPress.WP.AlternativeFunctions">
71-
<properties>
72-
<property name="exclude" value="file_get_contents,file_system_read" />
73-
<property name="exclude" value="json_encode,json_decode" />
74-
</properties>
75-
</rule>
76-
<rule ref="WordPress.WP.CronInterval" />
77-
<rule ref="WordPress.WP.CronInterval.CronSchedulesInterval">
78-
<type>error</type>
79-
<message>Scheduling crons at %s sec ( less than %s minutes ) is prohibited.</message>
80-
</rule>
81-
<rule ref="WordPress.WP.PostsPerPage" />
82-
<rule ref="WordPress.WP.PostsPerPage.posts_per_page_numberposts">
83-
<type>error</type>
84-
</rule>
85-
<rule ref="WordPress.WP.PostsPerPage.posts_per_page_posts_per_page">
86-
<type>error</type>
87-
</rule>
88-
<rule ref="PEAR.Functions.FunctionCallSignature">
89-
<properties>
90-
<property name="allowMultipleArguments" value="true"/>
91-
</properties>
92-
</rule>
93-
<rule ref="PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket">
94-
<severity phpcs-only="true">0</severity>
95-
</rule>
96-
<rule ref="PEAR.Functions.FunctionCallSignature.CloseBracketLine">
97-
<severity phpcs-only="true">0</severity>
98-
</rule>
99-
<!-- Single statement per line. -->
100-
<rule ref="Generic.Formatting.DisallowMultipleStatements" />
101-
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace">
102-
<exclude name="Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines" />
103-
</rule>
104-
<rule ref="Generic.Arrays.ArrayIndent">
105-
<properties>
106-
<property name="indent" value="2"/>
107-
</properties>
108-
</rule>
109-
<rule ref="Generic.Arrays.DisallowLongArraySyntax" />
4+
5+
<rule ref="Neuralab-Empty"/>
6+
<rule ref="WordPress-Core" />
7+
<rule ref="WordPress-Docs">
8+
<!-- Don't force file comments -->
9+
<exclude name="Squiz.Commenting.FileComment"/>
10+
<!-- Allow embedded php without semicolon -->
11+
<exclude name="Squiz.PHP.EmbeddedPhp.NoSemicolon"/>
12+
</rule>
13+
<rule ref="WordPress-Extra"/>
14+
11015
</ruleset>

0 commit comments

Comments
 (0)