-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DisallowSpaceIndent: Fix the case of the moving space
Given this code: ```php wp_die( $api ); // Tab - Space - Tab - Tab ``` with tab width set to `4`, `wp_die()` would start in column 13. The sniff was currently fixing this to: ```php wp_die( $api ); // Tab - Tab - Tab - Space ``` which changed the start column to 14 and changed the "space hidden before a tab" to precision alignment. This commit fixes that and is a further iteration building onto the improvements in 1404. The above code will now be fixed as: ```php wp_die( $api ); // Tab - Tab - Tab ``` Notes: * As the tabs in whitespace at the start of `T_INLINE_HTML` and `T_COMMENT` tokens is not replaced by spaces in the `content` by the tokenizer, this has to be done within the sniff to determine what the correct length of the whitespace should be. * Basing the correction of the space-based length of the whitespace allows for fixing with higher precision. * Incidentally, this also fixes one of the metrics being recorded incorrectly. For in-depth details of the effect on the metrics of this fix, please see: https://gist.github.com/jrfnl/5e2d75894c8e60a8f314b9fcb0ad3f62 * The `tabWidth` is now set in the unit test file.
- Loading branch information
Showing
3 changed files
with
39 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters