mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-31 15:48:22 +00:00
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:
parent
f49cfb6c28
commit
5caef89af3
8 changed files with 29 additions and 35 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
||||
|
|
|
@ -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
|
||||
|
|
||||
|
|
|
@ -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
|
||||
|
||||
|
@ -100,9 +99,8 @@ Module(
|
|||
## Errors
|
||||
|
||||
|
|
||||
1 | if call(foo, [a, b
|
||||
| ___________________^
|
||||
2 | | def bar():
|
||||
| |_^ Syntax Error: Expected ']', found NonLogicalNewline
|
||||
3 | pass
|
||||
1 | if call(foo, [a, b
|
||||
| ^ Syntax Error: Expected ']', found NonLogicalNewline
|
||||
2 | def bar():
|
||||
3 | pass
|
||||
|
|
||||
|
|
|
@ -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
|
||||
|
||||
|
@ -82,10 +81,9 @@ Module(
|
|||
## Errors
|
||||
|
||||
|
|
||||
1 | call(a, b, # comment \
|
||||
| _______________________^
|
||||
2 | |
|
||||
| |_^ Syntax Error: Expected ')', found newline
|
||||
3 | def bar():
|
||||
4 | pass
|
||||
1 | call(a, b, # comment \
|
||||
| ^ Syntax Error: Expected ')', found newline
|
||||
2 |
|
||||
3 | def bar():
|
||||
4 | pass
|
||||
|
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue