Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ruff] update and vendor annotate-snippets #15359

Merged
merged 23 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
143bd49
crates: vendor `annotate-snippets` crate
BurntSushi Dec 20, 2024
45bd9a1
ruff_annotate_snippets: make small change to enable omitting header
BurntSushi Dec 20, 2024
8ebb10e
ruff_linter,ruff_python_parser: migrate to updated `annotate-snippets`
BurntSushi Dec 20, 2024
dbc8732
ruff_linter: fix handling of unprintable characters
BurntSushi Jan 8, 2025
d97d74f
test: update snapshots with just whitespace changes
BurntSushi Jan 7, 2025
e1802df
test: update snapshots with missing annotations
BurntSushi Jan 7, 2025
566618c
test: update formatting of multi-line annotations
BurntSushi Jan 7, 2025
b905928
test: update snapshots with missing `^`
BurntSushi Jan 7, 2025
9228a2b
test: update snapshots with improper end-of-line placement
BurntSushi Jan 7, 2025
3f19d13
test: another line terminator bug fix
BurntSushi Jan 7, 2025
2a9f5ad
test: another set of updates related to line terminator handling
BurntSushi Jan 8, 2025
638c9a8
test: update snapshot with fixed annotation but carets include whites…
BurntSushi Jan 8, 2025
0b165ac
test: update another improperly rendered range
BurntSushi Jan 8, 2025
42160c1
ruff_annotate_snippets: update snapshot for single ASCII whitespace s…
BurntSushi Jan 8, 2025
51911c4
ruff_annotate_snippets: fix false positive line trimming
BurntSushi Jan 8, 2025
c3f4a65
ruff_annotate_snippets: support overriding the "cut indicator"
BurntSushi Jan 9, 2025
6d680d1
test: update snapshots with trimmed lines
BurntSushi Jan 8, 2025
50a77d1
test: tweak in alignment involving unprintable characters
BurntSushi Jan 8, 2025
85b441a
codeowners: make BurntSushi owner of ruff_annotate_snippets
BurntSushi Jan 14, 2025
17f5138
test: another update to add back a caret
BurntSushi Jan 14, 2025
ba5ccbb
test: add more missing carets
BurntSushi Jan 14, 2025
458153d
test: update a few indentation related diagnostics
BurntSushi Jan 14, 2025
6b3bda4
ruff_linter: adjust empty spans after line terminator more generally
BurntSushi Jan 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
source: crates/ruff_linter/src/rules/flake8_implicit_str_concat/mod.rs
snapshot_kind: text
---
ISC_syntax_error.py:2:5: SyntaxError: missing closing quote in string literal
|
Expand Down Expand Up @@ -59,7 +58,7 @@ ISC_syntax_error.py:4:1: ISC001 Implicitly concatenated string literals on one l
4 | / "a" """b
5 | | c""" "d
| |____^ ISC001
6 |
6 |
7 | # For f-strings, the `FStringRanges` won't contain the range for
|
= help: Combine string literals
Expand All @@ -70,7 +69,7 @@ ISC_syntax_error.py:5:6: SyntaxError: missing closing quote in string literal
4 | "a" """b
5 | c""" "d
| ^
6 |
6 |
7 | # For f-strings, the `FStringRanges` won't contain the range for
|

Expand All @@ -80,7 +79,7 @@ ISC_syntax_error.py:5:8: SyntaxError: Expected a statement
4 | "a" """b
5 | c""" "d
| ^
6 |
6 |
7 | # For f-strings, the `FStringRanges` won't contain the range for
8 | # unterminated f-strings.
|
Expand Down Expand Up @@ -144,7 +143,7 @@ ISC_syntax_error.py:11:1: ISC001 Implicitly concatenated string literals on one
11 | / f"a" f"""b
12 | | c""" f"d {e
| |____^ ISC001
13 |
13 |
14 | (
|
= help: Combine string literals
Expand Down Expand Up @@ -173,10 +172,12 @@ ISC_syntax_error.py:30:1: SyntaxError: unexpected EOF while parsing
|
28 | "i" "j"
29 | )
| ^
|

ISC_syntax_error.py:30:1: SyntaxError: f-string: unterminated string
|
28 | "i" "j"
29 | )
| ^
|
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
source: crates/ruff_linter/src/rules/flake8_implicit_str_concat/mod.rs
snapshot_kind: text
---
ISC_syntax_error.py:2:5: SyntaxError: missing closing quote in string literal
|
Expand Down Expand Up @@ -47,7 +46,7 @@ ISC_syntax_error.py:5:6: SyntaxError: missing closing quote in string literal
4 | "a" """b
5 | c""" "d
| ^
6 |
6 |
7 | # For f-strings, the `FStringRanges` won't contain the range for
|

Expand All @@ -57,7 +56,7 @@ ISC_syntax_error.py:5:8: SyntaxError: Expected a statement
4 | "a" """b
5 | c""" "d
| ^
6 |
6 |
7 | # For f-strings, the `FStringRanges` won't contain the range for
8 | # unterminated f-strings.
|
Expand Down Expand Up @@ -127,10 +126,12 @@ ISC_syntax_error.py:30:1: SyntaxError: unexpected EOF while parsing
|
28 | "i" "j"
29 | )
| ^
|

ISC_syntax_error.py:30:1: SyntaxError: f-string: unterminated string
|
28 | "i" "j"
29 | )
| ^
|
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
source: crates/ruff_linter/src/rules/isort/mod.rs
snapshot_kind: text
---
separate_subpackage_first_and_third_party_imports.py:1:1: I001 [*] Import block is un-sorted or un-formatted
|
Expand All @@ -12,6 +11,7 @@ separate_subpackage_first_and_third_party_imports.py:1:1: I001 [*] Import block
6 | | import foo
7 | | import foo.bar
8 | | import foo.bar.baz
| |___________________^ I001
|
= help: Organize imports

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
source: crates/ruff_linter/src/rules/isort/mod.rs
snapshot_kind: text
---
separate_subpackage_first_and_third_party_imports.py:1:1: I001 [*] Import block is un-sorted or un-formatted
|
Expand All @@ -12,6 +11,7 @@ separate_subpackage_first_and_third_party_imports.py:1:1: I001 [*] Import block
6 | | import foo
7 | | import foo.bar
8 | | import foo.bar.baz
| |___________________^ I001
|
= help: Organize imports

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
source: crates/ruff_linter/src/rules/isort/mod.rs
snapshot_kind: text
---
add_newline_before_comments.py:1:1: I001 [*] Import block is un-sorted or un-formatted
|
Expand All @@ -11,6 +10,7 @@ add_newline_before_comments.py:1:1: I001 [*] Import block is un-sorted or un-for
5 | | # This is a comment, but it starts a new section, so we don't need to add a newline
6 | | # before it.
7 | | import leading_prefix
| |______________________^ I001
|
= help: Organize imports

Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
---
source: crates/ruff_linter/src/rules/isort/mod.rs
snapshot_kind: text
---
as_imports_comments.py:1:1: I001 [*] Import block is un-sorted or un-formatted
|
1 | / from foo import ( # Comment on `foo`
2 | | Member as Alias, # Comment on `Alias`
3 | | )
4 | |
4 | |
5 | | from bar import ( # Comment on `bar`
6 | | Member, # Comment on `Member`
7 | | )
8 | |
8 | |
9 | | from baz import ( # Comment on `baz`
10 | | Member as Alias # Comment on `Alias`
11 | | )
12 | |
12 | |
13 | | from bop import ( # Comment on `bop`
14 | | Member # Comment on `Member`
15 | | )
| |__^ I001
|
= help: Organize imports

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
source: crates/ruff_linter/src/rules/isort/mod.rs
snapshot_kind: text
---
case_sensitive.py:1:1: I001 [*] Import block is un-sorted or un-formatted
|
Expand All @@ -13,6 +12,7 @@ case_sensitive.py:1:1: I001 [*] Import block is un-sorted or un-formatted
7 | | import f
8 | | from g import a, B, c
9 | | from h import A, b, C
| |______________________^ I001
|
= help: Organize imports

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
source: crates/ruff_linter/src/rules/isort/mod.rs
snapshot_kind: text
---
relative_imports_order.py:1:1: I001 [*] Import block is un-sorted or un-formatted
|
1 | / from ... import a
2 | | from .. import b
3 | | from . import c
| |________________^ I001
|
= help: Organize imports

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
source: crates/ruff_linter/src/rules/isort/mod.rs
snapshot_kind: text
---
combine_as_imports.py:1:1: I001 [*] Import block is un-sorted or un-formatted
|
1 | / from module import Class as C
2 | | from module import CONSTANT
3 | | from module import function
4 | | from module import function as f
| |_________________________________^ I001
|
= help: Organize imports

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
source: crates/ruff_linter/src/rules/isort/mod.rs
snapshot_kind: text
---
combine_as_imports.py:1:1: I001 [*] Import block is un-sorted or un-formatted
|
1 | / from module import Class as C
2 | | from module import CONSTANT
3 | | from module import function
4 | | from module import function as f
| |_________________________________^ I001
|
= help: Organize imports

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
source: crates/ruff_linter/src/rules/isort/mod.rs
snapshot_kind: text
---
combine_import_from.py:1:1: I001 [*] Import block is un-sorted or un-formatted
|
Expand All @@ -9,6 +8,7 @@ combine_import_from.py:1:1: I001 [*] Import block is un-sorted or un-formatted
3 | | from collections import Collection
4 | | from collections import ChainMap
5 | | from collections import MutableSequence, MutableMapping
| |________________________________________________________^ I001
|
= help: Organize imports

Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
---
source: crates/ruff_linter/src/rules/isort/mod.rs
snapshot_kind: text
---
comments.py:3:1: I001 [*] Import block is un-sorted or un-formatted
|
1 | # Comment 1
2 | # Comment 2
3 | / import D
4 | |
4 | |
5 | | # Comment 3a
6 | | import C
7 | |
7 | |
8 | | # Comment 3b
9 | | import C
10 | |
10 | |
11 | | import B # Comment 4
12 | |
12 | |
13 | | # Comment 5
14 | |
14 | |
15 | | # Comment 6
16 | | from A import (
17 | | a, # Comment 7
Expand All @@ -29,14 +28,15 @@ comments.py:3:1: I001 [*] Import block is un-sorted or un-formatted
23 | | b, # Comment 10
24 | | c, # Comment 11
25 | | )
26 | |
26 | |
27 | | from D import a_long_name_to_force_multiple_lines # Comment 12
28 | | from D import another_long_name_to_force_multiple_lines # Comment 13
29 | |
29 | |
30 | | from E import a # Comment 1
31 | |
31 | |
32 | | from F import a # Comment 1
33 | | from F import b
| |________________^ I001
|
= help: Organize imports

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
source: crates/ruff_linter/src/rules/isort/mod.rs
snapshot_kind: text
---
deduplicate_imports.py:1:1: I001 [*] Import block is un-sorted or un-formatted
|
1 | / import os
2 | | import os
3 | | import os as os1
4 | | import os as os2
| |_________________^ I001
|
= help: Organize imports

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
source: crates/ruff_linter/src/rules/isort/mod.rs
snapshot_kind: text
---
bar.py:1:1: I001 [*] Import block is un-sorted or un-formatted
|
1 | / import os
2 | | import pandas
3 | | import foo.baz
| |_______________^ I001
|
= help: Organize imports

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
source: crates/ruff_linter/src/rules/isort/mod.rs
snapshot_kind: text
---
fit_line_length.py:7:1: I001 [*] Import block is un-sorted or un-formatted
|
Expand All @@ -13,6 +12,7 @@ fit_line_length.py:7:1: I001 [*] Import block is un-sorted or un-formatted
12 | | from line_with_93 import (
13 | | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
14 | | )
| |______^ I001
|
= help: Organize imports

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
source: crates/ruff_linter/src/rules/isort/mod.rs
snapshot_kind: text
---
fit_line_length_comment.py:1:1: I001 [*] Import block is un-sorted or un-formatted
|
Expand All @@ -12,6 +11,7 @@ fit_line_length_comment.py:1:1: I001 [*] Import block is un-sorted or un-formatt
6 | | from f import g # 012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ
7 | | # The next import doesn't fit on one line.
8 | | from h import i # 012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9
| |__________________________________________________________________________________________^ I001
|
= help: Organize imports

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
source: crates/ruff_linter/src/rules/isort/mod.rs
snapshot_kind: text
---
force_single_line.py:1:1: I001 [*] Import block is un-sorted or un-formatted
|
Expand All @@ -12,25 +11,26 @@ force_single_line.py:1:1: I001 [*] Import block is un-sorted or un-formatted
6 | | from json import load
7 | | from json import loads as json_loads
8 | | from logging.handlers import StreamHandler, FileHandler
9 | |
9 | |
10 | | # comment 1
11 | | from third_party import lib1, lib2, \
12 | | lib3, lib7, lib5, lib6
13 | | # comment 2
14 | | from third_party import lib4
15 | |
15 | |
16 | | from foo import bar # comment 3
17 | | from foo2 import bar2 # comment 4
18 | | from foo3 import bar3, baz3 # comment 5
19 | |
19 | |
20 | | # comment 6
21 | | from bar import (
22 | | a, # comment 7
23 | | b, # comment 8
24 | | )
25 | |
25 | |
26 | | # comment 9
27 | | from baz import * # comment 10
| |________________________________^ I001
|
= help: Organize imports

Expand Down
Loading