Skip to content

Commit 890b579

Browse files
authored
Merge pull request #122 from fredden/own-coding-standard
Respect all sniffs when reviewing PHP_CodeSniffer itself
2 parents ddba452 + 4569959 commit 890b579

File tree

1 file changed

+14
-28
lines changed

1 file changed

+14
-28
lines changed

phpcs.xml.dist

Lines changed: 14 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,7 @@
1515
<arg name="basepath" value="."/>
1616
<arg name="colors"/>
1717
<arg name="parallel" value="75"/>
18-
<arg value="np"/>
19-
20-
<!-- Don't hide tokenizer exceptions -->
21-
<rule ref="Internal.Tokenizer.Exception">
22-
<type>error</type>
23-
</rule>
18+
<arg value="p"/>
2419

2520
<!-- Include the whole PEAR standard -->
2621
<rule ref="PEAR">
@@ -32,6 +27,7 @@
3227
<exclude name="PEAR.Commenting.FileComment.MissingLinkTag"/>
3328
<exclude name="PEAR.Commenting.FileComment.MissingVersion"/>
3429
<exclude name="PEAR.Commenting.InlineComment"/>
30+
<exclude name="Generic.Files.LineLength"/>
3531
</rule>
3632

3733
<!-- Include some sniffs from other standards that don't conflict with PEAR -->
@@ -76,13 +72,6 @@
7672
<rule ref="PSR12.Files.OpenTag"/>
7773
<rule ref="Zend.Files.ClosingTag"/>
7874

79-
<!-- PEAR uses warnings for inline control structures, so switch back to errors -->
80-
<rule ref="Generic.ControlStructures.InlineControlStructure">
81-
<properties>
82-
<property name="error" value="true"/>
83-
</properties>
84-
</rule>
85-
8675
<!-- We use custom indent rules for arrays -->
8776
<rule ref="Generic.Arrays.ArrayIndent"/>
8877
<rule ref="Squiz.Arrays.ArrayDeclaration.KeyNotAligned">
@@ -111,11 +100,10 @@
111100
</properties>
112101
</rule>
113102

114-
<!-- Have 12 chars padding maximum and always show as errors -->
103+
<!-- Have 12 chars padding maximum -->
115104
<rule ref="Generic.Formatting.MultipleStatementAlignment">
116105
<properties>
117106
<property name="maxPadding" value="12"/>
118-
<property name="error" value="true"/>
119107
</properties>
120108
</rule>
121109

@@ -132,20 +120,8 @@
132120
</properties>
133121
</rule>
134122

135-
<!-- Private methods MUST not be prefixed with an underscore -->
136-
<rule ref="PSR2.Methods.MethodDeclaration.Underscore">
137-
<type>error</type>
138-
</rule>
139-
140-
<!-- Private properties MUST not be prefixed with an underscore -->
141-
<rule ref="PSR2.Classes.PropertyDeclaration.Underscore">
142-
<type>error</type>
143-
</rule>
144-
145123
<!-- Do not allow unreachable code. -->
146-
<rule ref="Squiz.PHP.NonExecutableCode">
147-
<type>error</type>
148-
</rule>
124+
<rule ref="Squiz.PHP.NonExecutableCode"/>
149125

150126
<!-- The testing bootstrap file uses string concats to stop IDEs seeing the class aliases -->
151127
<rule ref="Generic.Strings.UnnecessaryStringConcat">
@@ -157,4 +133,14 @@
157133
<exclude-pattern>tests/Core/Tokenizer/StableCommentWhitespaceWinTest\.php</exclude-pattern>
158134
</rule>
159135

136+
<!-- Avoid false positive with this sniff detecting itself -->
137+
<rule ref="Generic.Commenting.Todo">
138+
<exclude-pattern>src/Standards/Generic/Sniffs/Commenting/TodoSniff\.php</exclude-pattern>
139+
<exclude-pattern>src/Standards/Generic/Tests/Commenting/TodoUnitTest\.php</exclude-pattern>
140+
</rule>
141+
142+
<!-- @see https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/122#discussion_r1414167897 -->
143+
<rule ref="Squiz.Commenting.VariableComment">
144+
<exclude-pattern>src/Util/Tokens\.php</exclude-pattern>
145+
</rule>
160146
</ruleset>

0 commit comments

Comments
 (0)