test: update snapshots with improper end-of-line placement

This looks like a bug fix that occurs when the annotation is a
zero-width span immediately following a line terminator. Previously, the
caret seems to be rendered on the next line, but it should be rendered
at the end of the line the span corresponds to.

I admit that this one is kinda weird. I would somewhat expect that our
spans here are actually incorrect, and that to obtain this sort of
rendering, we should identify a span just immediately _before_ the line
terminator and not after it. But I don't want to dive into that rabbit
hole for now (and given how `annotate-snippets` now renders these
spans, perhaps there is more to it than I see), and this does seem like
a clear improvement given the spans we feed to `annotate-snippets`.
This commit is contained in:
Andrew Gallant 2025-01-07 14:46:50 -05:00 committed by Andrew Gallant
parent f49cfb6c28
commit 5caef89af3
8 changed files with 29 additions and 35 deletions

View file

@ -1,12 +1,11 @@
---
source: crates/ruff_linter/src/rules/isort/mod.rs
snapshot_kind: text
---
line_ending_crlf.py:1:1: I001 [*] Import block is un-sorted or un-formatted
|
1 | / from long_module_name import member_one, member_two, member_three, member_four, member_five
2 | |
| |_^ I001
1 | from long_module_name import member_one, member_two, member_three, member_four, member_five
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ I001
2 |
|
= help: Organize imports

View file

@ -1,12 +1,11 @@
---
source: crates/ruff_linter/src/rules/isort/mod.rs
snapshot_kind: text
---
line_ending_lf.py:1:1: I001 [*] Import block is un-sorted or un-formatted
|
1 | / from long_module_name import member_one, member_two, member_three, member_four, member_five
2 | |
| |_^ I001
1 | from long_module_name import member_one, member_two, member_three, member_four, member_five
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ I001
2 |
|
= help: Organize imports

View file

@ -1,10 +1,10 @@
---
source: crates/ruff_linter/src/rules/isort/mod.rs
snapshot_kind: text
---
no_wrap_star.py:1:1: I001 [*] Import block is un-sorted or un-formatted
|
1 | / from .subscription import * # type: ignore # some very long comment explaining why this needs a type ignore
1 | from .subscription import * # type: ignore # some very long comment explaining why this needs a type ignore
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ I001
|
= help: Organize imports

View file

@ -1,14 +1,13 @@
---
source: crates/ruff_linter/src/rules/isort/mod.rs
snapshot_kind: text
---
split.py:15:1: I001 [*] Import block is un-sorted or un-formatted
|
14 | if True:
15 | / import C
16 | | import A
17 | |
| |_^ I001
| |_____________^ I001
17 |
18 | # isort: split
|
= help: Organize imports
@ -30,8 +29,8 @@ split.py:20:1: I001 [*] Import block is un-sorted or un-formatted
19 |
20 | / import D
21 | | import B
22 | |
| |_^ I001
| |_____________^ I001
22 |
23 |
24 | import e
|
@ -54,6 +53,7 @@ split.py:30:1: I001 [*] Import block is un-sorted or un-formatted
29 |
30 | / import d
31 | | import c
| |_________^ I001
|
= help: Organize imports

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/inline/err/if_stmt_misspelled_elif.py
snapshot_kind: text
---
## AST
@ -90,8 +89,8 @@ Module(
|
3 | elf:
4 | pass
| ^ Syntax Error: Expected a statement
5 | else:
| Syntax Error: Expected a statement
6 | pass
|
@ -125,4 +124,5 @@ Module(
|
5 | else:
6 | pass
| ^ Syntax Error: Expected a statement
|

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/inline/err/match_stmt_expected_case_block.py
snapshot_kind: text
---
## AST
@ -113,8 +112,8 @@ Module(
|
1 | match x:
2 | x = 1
| ^ Syntax Error: Expected a statement
3 | match x:
| Syntax Error: Expected a statement
4 | match y:
5 | case _: ...
|
@ -132,4 +131,5 @@ Module(
|
4 | match y:
5 | case _: ...
| ^ Syntax Error: Expected a statement
|

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/re_lex_logical_token_windows_eol.py
snapshot_kind: text
---
## AST
@ -101,8 +100,7 @@ Module(
|
1 | if call(foo, [a, b
| ___________________^
2 | | def bar():
| |_^ Syntax Error: Expected ']', found NonLogicalNewline
| ^ Syntax Error: Expected ']', found NonLogicalNewline
2 | def bar():
3 | pass
|

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/re_lexing/line_continuation_windows_eol.py
snapshot_kind: text
---
## AST
@ -83,9 +82,8 @@ Module(
|
1 | call(a, b, # comment \
| _______________________^
2 | |
| |_^ Syntax Error: Expected ')', found newline
| ^ Syntax Error: Expected ')', found newline
2 |
3 | def bar():
4 | pass
|