Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Respect all sniffs when reviewing PHP_CodeSniffer itself #122

Merged
merged 1 commit into from
Dec 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 14 additions & 28 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,7 @@
<arg name="basepath" value="."/>
<arg name="colors"/>
<arg name="parallel" value="75"/>
<arg value="np"/>

<!-- Don't hide tokenizer exceptions -->
<rule ref="Internal.Tokenizer.Exception">
<type>error</type>
</rule>
<arg value="p"/>

<!-- Include the whole PEAR standard -->
<rule ref="PEAR">
Expand All @@ -32,6 +27,7 @@
<exclude name="PEAR.Commenting.FileComment.MissingLinkTag"/>
<exclude name="PEAR.Commenting.FileComment.MissingVersion"/>
<exclude name="PEAR.Commenting.InlineComment"/>
<exclude name="Generic.Files.LineLength"/>
</rule>

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

<!-- PEAR uses warnings for inline control structures, so switch back to errors -->
<rule ref="Generic.ControlStructures.InlineControlStructure">
<properties>
<property name="error" value="true"/>
</properties>
</rule>

<!-- We use custom indent rules for arrays -->
<rule ref="Generic.Arrays.ArrayIndent"/>
<rule ref="Squiz.Arrays.ArrayDeclaration.KeyNotAligned">
Expand Down Expand Up @@ -111,11 +100,10 @@
</properties>
</rule>

<!-- Have 12 chars padding maximum and always show as errors -->
<!-- Have 12 chars padding maximum -->
<rule ref="Generic.Formatting.MultipleStatementAlignment">
<properties>
<property name="maxPadding" value="12"/>
<property name="error" value="true"/>
</properties>
</rule>

Expand All @@ -132,20 +120,8 @@
</properties>
</rule>

<!-- Private methods MUST not be prefixed with an underscore -->
<rule ref="PSR2.Methods.MethodDeclaration.Underscore">
<type>error</type>
</rule>

<!-- Private properties MUST not be prefixed with an underscore -->
<rule ref="PSR2.Classes.PropertyDeclaration.Underscore">
<type>error</type>
</rule>

<!-- Do not allow unreachable code. -->
<rule ref="Squiz.PHP.NonExecutableCode">
<type>error</type>
</rule>
<rule ref="Squiz.PHP.NonExecutableCode"/>

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

<!-- Avoid false positive with this sniff detecting itself -->
<rule ref="Generic.Commenting.Todo">
<exclude-pattern>src/Standards/Generic/Sniffs/Commenting/TodoSniff\.php</exclude-pattern>
<exclude-pattern>src/Standards/Generic/Tests/Commenting/TodoUnitTest\.php</exclude-pattern>
</rule>

<!-- @see https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/122#discussion_r1414167897 -->
<rule ref="Squiz.Commenting.VariableComment">
<exclude-pattern>src/Util/Tokens\.php</exclude-pattern>
</rule>
</ruleset>