Skip to content

Commit

Permalink
Replace the WordPress.WhiteSpace.PrecisionAlignment sniff
Browse files Browse the repository at this point in the history
... with a similar sniff as merged upstream in PHPCSExtra as `Universal.WhiteSpace.PrecisionAlignment`.

The upstream sniff has various improvements, including:
* Detecting precision alignment in the leading whitespace for PHP 7.3 flexible heredoc/nowdoc closing identifiers (was false negative).
* Improved handling of (trailing) whitespace on otherwise blank lines, both in code as well as in comments and HTML. This will now be ignored by default. (was false positive).
* An additional option to report on precision alignment for whitespace found on otherwise blank lines (not relevant for WP as the `Squiz.WhiteSpace.SuperfluousWhitespace` is used).
* And it also includes a fixer.
    Note: the fixer works based on "best guess" and may not always result in the desired indentation.

Ref:
* PHPCSStandards/PHPCSExtra 119
* PHPCSStandards/PHPCSExtra 122
* PHPCSStandards/PHPCSExtra 123
* PHPCSStandards/PHPCSExtra 124
  • Loading branch information
jrfnl committed Dec 7, 2022
1 parent eddec93 commit a6ab33f
Show file tree
Hide file tree
Showing 15 changed files with 1 addition and 617 deletions.
2 changes: 1 addition & 1 deletion WordPress-Core/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@

<!-- Covers rule: Use real tabs and not spaces. -->
<rule ref="Generic.WhiteSpace.DisallowSpaceIndent"/>
<rule ref="WordPress.WhiteSpace.PrecisionAlignment"/>
<rule ref="Universal.WhiteSpace.PrecisionAlignment"/>

<!-- Generic array layout check. -->
<!-- Covers rule: For associative arrays, each item should start on a new line
Expand Down
35 changes: 0 additions & 35 deletions WordPress/Docs/WhiteSpace/PrecisionAlignmentStandard.xml

This file was deleted.

199 changes: 0 additions & 199 deletions WordPress/Sniffs/WhiteSpace/PrecisionAlignmentSniff.php

This file was deleted.

68 changes: 0 additions & 68 deletions WordPress/Tests/WhiteSpace/PrecisionAlignmentUnitTest.1.inc

This file was deleted.

44 changes: 0 additions & 44 deletions WordPress/Tests/WhiteSpace/PrecisionAlignmentUnitTest.2.inc

This file was deleted.

14 changes: 0 additions & 14 deletions WordPress/Tests/WhiteSpace/PrecisionAlignmentUnitTest.3.inc

This file was deleted.

5 changes: 0 additions & 5 deletions WordPress/Tests/WhiteSpace/PrecisionAlignmentUnitTest.4.inc

This file was deleted.

Loading

0 comments on commit a6ab33f

Please sign in to comment.