Skip to content

[ruff] update and vendor annotate-snippets #15359

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

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,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/re_lexing/fstring_format_spec_1.py
snapshot_kind: text
---
## AST

Expand Down Expand Up @@ -301,7 +300,7 @@ Module(
5 | f'middle {'string':\
6 | 'format spec'}
| ^ Syntax Error: f-string: expecting '}'
7 |
7 |
8 | f'middle {'string':\\
|

Expand All @@ -310,7 +309,7 @@ Module(
5 | f'middle {'string':\
6 | 'format spec'}
| ^^^^^^ Syntax Error: Simple statements must be separated by newlines or semicolons
7 |
7 |
8 | f'middle {'string':\\
|

Expand All @@ -319,7 +318,7 @@ Module(
5 | f'middle {'string':\
6 | 'format spec'}
| ^^^^ Syntax Error: Simple statements must be separated by newlines or semicolons
7 |
7 |
8 | f'middle {'string':\\
|

Expand All @@ -328,7 +327,7 @@ Module(
5 | f'middle {'string':\
6 | 'format spec'}
| ^^ Syntax Error: missing closing quote in string literal
7 |
7 |
8 | f'middle {'string':\\
|

Expand All @@ -337,17 +336,17 @@ Module(
5 | f'middle {'string':\
6 | 'format spec'}
| ^ Syntax Error: Expected a statement
7 |
7 |
8 | f'middle {'string':\\
9 | 'format spec'}
|


|
6 | 'format spec'}
7 |
7 |
8 | f'middle {'string':\\
| Syntax Error: f-string: unterminated string
| ^ Syntax Error: f-string: unterminated string
9 | 'format spec'}
|

Expand All @@ -356,7 +355,7 @@ Module(
8 | f'middle {'string':\\
9 | 'format spec'}
| ^^^^^^^^ Syntax Error: Unexpected indentation
10 |
10 |
11 | f'middle {'string':\\\
|

Expand All @@ -365,7 +364,7 @@ Module(
8 | f'middle {'string':\\
9 | 'format spec'}
| ^ Syntax Error: Expected a statement
10 |
10 |
11 | f'middle {'string':\\\
|

Expand All @@ -374,17 +373,17 @@ Module(
8 | f'middle {'string':\\
9 | 'format spec'}
| ^ Syntax Error: Expected a statement
10 |
10 |
11 | f'middle {'string':\\\
12 | 'format spec'}
|


|
9 | 'format spec'}
10 |
10 |
| ^ Syntax Error: Expected a statement
11 | f'middle {'string':\\\
| Syntax Error: Expected a statement
12 | 'format spec'}
|

Expand Down Expand Up @@ -420,5 +419,5 @@ Module(
|
11 | f'middle {'string':\\\
12 | 'format spec'}
| Syntax Error: Expected a statement
| ^ Syntax Error: Expected a statement
|
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/statements/if_extra_indent.py
snapshot_kind: text
---
## AST

Expand Down Expand Up @@ -92,14 +91,14 @@ Module(
3 | pass
4 | a + b
| ^^^^^^^^ Syntax Error: Unexpected indentation
5 |
5 |
6 | pass
|


|
6 | pass
7 |
7 |
| ^ Syntax Error: Expected a statement
8 | a = 10
| Syntax Error: Expected a statement
|
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/inline/err/try_stmt_misspelled_except.py
snapshot_kind: text
---
## AST

Expand Down Expand Up @@ -198,8 +197,8 @@ Module(
|
3 | exept: # spellchecker:disable-line
4 | pass
| ^ Syntax Error: Expected a statement
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. I guess this is another case where the offset used to be at the start of the line and the caret now ends up at the end of the previous line. Unfortunately, this will be harder to fix, and I don't think we have tests for every position where we expect a node.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aye, I filed an issue about this: #15510

5 | finally:
| Syntax Error: Expected a statement
6 | pass
7 | a = 1
|
Expand Down Expand Up @@ -239,8 +238,8 @@ Module(
|
5 | finally:
6 | pass
| ^ Syntax Error: Expected a statement
7 | a = 1
| Syntax Error: Expected a statement
8 | try:
9 | pass
|
Expand Down Expand Up @@ -268,6 +267,6 @@ Module(
|
12 | exept: # spellchecker:disable-line
13 | pass
| ^ Syntax Error: Expected a statement
14 | b = 1
| Syntax Error: Expected a statement
|