Blink parity: preserve import indent in braced namespace; gate to 0.8% - #134
Merged
Merged
Conversation
SingleLineAfterImports rewrote the whitespace after the last import to a bare "\n\n", dropping the indentation of the following line, so a class inside a braced namespace de-indented to column 0. Keep the import line's own indent after the blank line and leave a whitespace that already holds one blank line untouched, matching php-cs-fixer.
Unit-test SingleLineAfterImports preserving the following line's indent inside a braced namespace, and lower MAX_DIFF_PERCENT to 0.8 (actual 0.795%).
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the last mautic parity diff and ratchets the gate under 0.8%. Measured drop: 37 to 36 differing files of 4527 (0.795%).
The fix
SingleLineAfterImportsrewrote the whitespace after the last import to a bare"\n\n", dropping the following line's indentation. Inside a braced namespace (namespace X { use ...; final class ... }) that de-indented the class to column 0. It now keeps the import line's own indentation after the blank line, and leaves a whitespace that already holds exactly one blank line untouched, matching php-cs-fixer. Top-level (non-braced) imports have an empty indent, so their behavior is unchanged.This was initially suspected to be StatementIndentation, but a config bisect and the fixer priorities (StatementIndentation -3 runs before SingleLineAfterImports -11) pinned it to the import fixer - StatementIndentation could not repair what the import fixer mangled afterward.
Gate
MAX_DIFF_PERCENTlowered 1.0 to 0.8; actual is 0.795% (36 of 4527).Unit tests cover the braced-namespace indent and the existing-blank-line no-op. Full blink suite, go vet and golangci-lint are green; the strict rector-src 1:1 gate stays 0-diff.