ruff
8979271e - Always expand tabs to four spaces in diagnostics (#19618)

Commit
49 days ago
Always expand tabs to four spaces in diagnostics (#19618) ## Summary I was a bit stuck on some snapshot differences I was seeing in #19415, but @BurntSushi pointed out that `annotate-snippets` already normalizes tabs on its own, which was very helpful! Instead of applying this change directly to the other branch, I wanted to try applying it in `ruff_linter` first. This should very slightly reduce the number of changes in #19415 proper. It looks like `annotate-snippets` always expands a tab to four spaces, whereas I think we were aligning to tab stops: ```diff 6 | spam(ham[1], { eggs: 2}) 7 | #: E201:1:6 - 8 | spam( ham[1], {eggs: 2}) - | ^^^ E201 + 8 | spam( ham[1], {eggs: 2}) + | ^^^^ E201 ``` ```diff 61 | #: E203:2:15 E702:2:16 62 | if x == 4: -63 | print(x, y) ; x, y = y, x - | ^ E203 +63 | print(x, y) ; x, y = y, x + | ^^^^ E203 ``` ```diff E27.py:15:6: E271 [*] Multiple spaces after keyword | -13 | True and False +13 | True and False 14 | #: E271 15 | a and b | ^^ E271 ``` I don't think this is too bad and has the major benefit of allowing us to pass the non-tab-expanded range to `annotate-snippets` in #19415, where it's also displayed in the header. Ruff doesn't have this problem currently because it uses its own concise diagnostic output as the header for full diagnostics, where the pre-expansion range is used directly. ## Test Plan Existing tests with a few snapshot updates
Author
Parents
Loading