Skip to content

Commit f8a7f82

Browse files
committed
Improve ruleset
Signed-off-by: Maurício Meneghini Fauth <mauriciofauth@gmail.com>
1 parent 2cfe6f6 commit f8a7f82

File tree

1 file changed

+53
-20
lines changed

1 file changed

+53
-20
lines changed

PMAStandard/ruleset.xml

Lines changed: 53 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,76 @@
11
<?xml version="1.0"?>
2-
<ruleset name="phpMyAdmin Standard" namespace="PMAStandard">
3-
<!-- https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml -->
4-
<description>phpMyAdmin PHP_CodeSniffer custom coding standard</description>
2+
<ruleset
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
name="phpMyAdmin"
5+
namespace="PMAStandard"
6+
xsi:noNamespaceSchemaLocation="../vendor/squizlabs/php_codesniffer/phpcs.xsd"
7+
>
8+
<description>The phpMyAdmin coding standard.</description>
59

610
<!-- The PSR-2 coding standard -->
7-
<rule ref="PSR2" />
11+
<rule ref="PSR2"/>
812

913
<!-- Short array syntax must be used to define arrays -->
10-
<rule ref="Generic.Arrays.DisallowLongArraySyntax" />
14+
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
15+
<!-- Ensures that array are indented with 4 spaces -->
16+
<rule ref="Generic.Arrays.ArrayIndent"/>
1117

1218
<!-- Functions should not have a nesting level greater than 10, and should try to stay below 5 -->
13-
<rule ref="Generic.Metrics.NestingLevel" />
19+
<rule ref="Generic.Metrics.NestingLevel"/>
20+
21+
<!-- Control Structures must have at least one statement inside of the body -->
22+
<rule ref="Generic.CodeAnalysis.EmptyStatement"/>
23+
24+
<!-- Ensures there is a single space after cast -->
25+
<rule ref="Generic.Formatting.SpaceAfterCast"/>
26+
<!-- Ensures there is a single space after a NOT operator -->
27+
<rule ref="Generic.Formatting.SpaceAfterNot"/>
1428

1529
<!-- Files, classes and functions must have a non-empty doc comment -->
1630
<rule ref="PEAR.Commenting.ClassComment">
17-
<exclude name="PEAR.Commenting.ClassComment.MissingCategoryTag" />
18-
<exclude name="PEAR.Commenting.ClassComment.MissingAuthorTag" />
19-
<exclude name="PEAR.Commenting.ClassComment.MissingLicenseTag" />
20-
<exclude name="PEAR.Commenting.ClassComment.MissingLinkTag" />
31+
<exclude name="PEAR.Commenting.ClassComment.MissingCategoryTag"/>
32+
<exclude name="PEAR.Commenting.ClassComment.MissingAuthorTag"/>
33+
<exclude name="PEAR.Commenting.ClassComment.MissingLicenseTag"/>
34+
<exclude name="PEAR.Commenting.ClassComment.MissingLinkTag"/>
2135
</rule>
2236
<rule ref="PEAR.Commenting.FileComment">
23-
<exclude name="PEAR.Commenting.FileComment.MissingCategoryTag" />
24-
<exclude name="PEAR.Commenting.FileComment.MissingAuthorTag" />
25-
<exclude name="PEAR.Commenting.FileComment.MissingLicenseTag" />
26-
<exclude name="PEAR.Commenting.FileComment.MissingLinkTag" />
27-
<exclude name="PEAR.Commenting.FileComment.MissingVersion" />
37+
<exclude name="PEAR.Commenting.FileComment.MissingCategoryTag"/>
38+
<exclude name="PEAR.Commenting.FileComment.MissingAuthorTag"/>
39+
<exclude name="PEAR.Commenting.FileComment.MissingLicenseTag"/>
40+
<exclude name="PEAR.Commenting.FileComment.MissingLinkTag"/>
41+
<exclude name="PEAR.Commenting.FileComment.MissingVersion"/>
2842
</rule>
29-
<rule ref="PEAR.Commenting.FunctionComment" />
43+
<rule ref="PEAR.Commenting.FunctionComment"/>
44+
<!-- Checks that no Perl-style # comments are used -->
45+
<rule ref="PEAR.Commenting.InlineComment"/>
46+
47+
<!-- Ensure that there are no spaces around square brackets -->
48+
<rule ref="Squiz.Arrays.ArrayBracketSpacing"/>
49+
<!-- Ensures that arrays conform to the array coding standard -->
50+
<rule ref="Squiz.Arrays.ArrayDeclaration">
51+
<exclude name="Squiz.Arrays.ArrayDeclaration.DoubleArrowNotAligned"/>
52+
<exclude name="Squiz.Arrays.ArrayDeclaration.KeyNotAligned"/>
53+
<exclude name="Squiz.Arrays.ArrayDeclaration.MultiLineNotAllowed"/>
54+
<exclude name="Squiz.Arrays.ArrayDeclaration.CloseBraceNotAligned"/>
55+
<exclude name="Squiz.Arrays.ArrayDeclaration.ValueNotAligned"/>
56+
</rule>
57+
58+
<!-- Tests that the stars in a doc comment align correctly -->
59+
<rule ref="Squiz.Commenting.DocCommentAlignment"/>
3060

3161
<!-- Makes sure there is only one space before and after the concatenation operator -->
3262
<rule ref="Squiz.Strings.ConcatenationSpacing">
3363
<properties>
34-
<property name="spacing" value="1" />
35-
<property name="ignoreNewlines" value="true" />
64+
<property name="spacing" value="1"/>
65+
<property name="ignoreNewlines" value="true"/>
3666
</properties>
3767
</rule>
3868

3969
<!-- Variable names should be camelCased with the first letter lowercase. -->
40-
<rule ref="Zend.NamingConventions.ValidVariableName">
41-
<exclude name="Zend.NamingConventions.ValidVariableName.PrivateNoUnderscore" />
70+
<rule ref="Squiz.NamingConventions.ValidVariableName">
71+
<!-- Checked by PSR2 -->
72+
<exclude name="Squiz.NamingConventions.ValidVariableName.PrivateNoUnderscore"/>
73+
<exclude name="Squiz.NamingConventions.ValidVariableName.PublicHasUnderscore"/>
74+
<type>warning</type>
4275
</rule>
4376
</ruleset>

0 commit comments

Comments
 (0)