Skip to content

Commit 7168ee8

Browse files
committed
Merge remote-tracking branch 'origin/main' into dcreager/abnormal
* origin/main: [ty] Fix flaky tests on macos (#21524) [ty] Add tests for generic implicit type aliases (#21522) [ty] Semantic tokens: consistently add the `DEFINITION` modifier (#21521) Only render hyperlinks for terminals known to support them (#21519) [ty] Keep colorizing `mypy_primer` output (#21515) [ty] Exit with `2` if there's any IO error (#21508) [`ruff`] Fix false positive for complex conversion specifiers in `logging-eager-conversion` (`RUF065`) (#21464) [ty] tighten up handling of subscripts in type expressions (#21503)
2 parents fb2c502 + ac9c83e commit 7168ee8

File tree

25 files changed

+579
-136
lines changed

25 files changed

+579
-136
lines changed

.github/workflows/mypy_primer.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ jobs:
5555
- name: Run mypy_primer
5656
env:
5757
PRIMER_SELECTOR: crates/ty_python_semantic/resources/primer/good.txt
58+
CLICOLOR_FORCE: "1"
5859
DIFF_FILE: mypy_primer.diff
5960
run: |
6061
cd ruff

.github/workflows/ty-ecosystem-analyzer.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ jobs:
6767
6868
cd ..
6969
70-
uv tool install "git+https://github.com/astral-sh/ecosystem-analyzer@0aff03414da5d242e97a9f43fb502e085637a4a1"
70+
uv tool install "git+https://github.com/astral-sh/ecosystem-analyzer@e5c5f5b2d762af91b28490537fe0077334165693"
7171
7272
ecosystem-analyzer \
7373
--repository ruff \

.github/workflows/ty-ecosystem-report.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
5353
cd ..
5454
55-
uv tool install "git+https://github.com/astral-sh/ecosystem-analyzer@0aff03414da5d242e97a9f43fb502e085637a4a1"
55+
uv tool install "git+https://github.com/astral-sh/ecosystem-analyzer@e5c5f5b2d762af91b28490537fe0077334165693"
5656
5757
ecosystem-analyzer \
5858
--verbose \

Cargo.lock

Lines changed: 16 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ snapbox = { version = "0.6.0", features = [
173173
static_assertions = "1.1.0"
174174
strum = { version = "0.27.0", features = ["strum_macros"] }
175175
strum_macros = { version = "0.27.0" }
176+
supports-hyperlinks = { version = "3.1.0" }
176177
syn = { version = "2.0.55" }
177178
tempfile = { version = "3.9.0" }
178179
test-case = { version = "3.3.1" }

crates/ruff_annotate_snippets/src/renderer/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,11 @@ impl Renderer {
155155
self
156156
}
157157

158+
pub const fn hyperlink(mut self, hyperlink: bool) -> Self {
159+
self.stylesheet.hyperlink = hyperlink;
160+
self
161+
}
162+
158163
/// Set the string used for when a long line is cut.
159164
///
160165
/// The default is `...` (three `U+002E` characters).

crates/ruff_benchmark/benches/ty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,7 @@ fn attrs(criterion: &mut Criterion) {
667667
max_dep_date: "2025-06-17",
668668
python_version: PythonVersion::PY313,
669669
},
670-
110,
670+
120,
671671
);
672672

673673
bench_project(&benchmark, criterion);

crates/ruff_db/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ schemars = { workspace = true, optional = true }
4242
serde = { workspace = true, optional = true }
4343
serde_json = { workspace = true, optional = true }
4444
similar = { workspace = true }
45+
supports-hyperlinks = { workspace = true }
4546
thiserror = { workspace = true }
4647
tracing = { workspace = true }
4748
tracing-subscriber = { workspace = true, optional = true }

crates/ruff_db/src/diagnostic/render/full.rs

Lines changed: 4 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ impl<'a> FullRenderer<'a> {
4949
.help(stylesheet.help)
5050
.line_no(stylesheet.line_no)
5151
.emphasis(stylesheet.emphasis)
52-
.none(stylesheet.none);
52+
.none(stylesheet.none)
53+
.hyperlink(stylesheet.hyperlink);
5354

5455
for diag in diagnostics {
5556
let resolved = Resolved::new(self.resolver, diag, self.config);
@@ -703,52 +704,7 @@ print()
703704
env.show_fix_status(true);
704705
env.fix_applicability(Applicability::DisplayOnly);
705706

706-
insta::assert_snapshot!(env.render_diagnostics(&diagnostics), @r"
707-
error[unused-import][*]: `os` imported but unused
708-
--> notebook.ipynb:cell 1:2:8
709-
|
710-
1 | # cell 1
711-
2 | import os
712-
| ^^
713-
|
714-
help: Remove unused import: `os`
715-
::: cell 1
716-
1 | # cell 1
717-
- import os
718-
719-
error[unused-import][*]: `math` imported but unused
720-
--> notebook.ipynb:cell 2:2:8
721-
|
722-
1 | # cell 2
723-
2 | import math
724-
| ^^^^
725-
3 |
726-
4 | print('hello world')
727-
|
728-
help: Remove unused import: `math`
729-
::: cell 2
730-
1 | # cell 2
731-
- import math
732-
2 |
733-
3 | print('hello world')
734-
735-
error[unused-variable][*]: Local variable `x` is assigned to but never used
736-
--> notebook.ipynb:cell 3:4:5
737-
|
738-
2 | def foo():
739-
3 | print()
740-
4 | x = 1
741-
| ^
742-
|
743-
help: Remove assignment to unused variable `x`
744-
::: cell 3
745-
1 | # cell 3
746-
2 | def foo():
747-
3 | print()
748-
- x = 1
749-
4 |
750-
note: This is an unsafe fix and may change runtime behavior
751-
");
707+
insta::assert_snapshot!(env.render_diagnostics(&diagnostics));
752708
}
753709

754710
#[test]
@@ -768,31 +724,7 @@ print()
768724
}
769725
*fix = Fix::unsafe_edits(edits.remove(0), edits);
770726

771-
insta::assert_snapshot!(env.render(&diagnostic), @r"
772-
error[unused-import][*]: `os` imported but unused
773-
--> notebook.ipynb:cell 1:2:8
774-
|
775-
1 | # cell 1
776-
2 | import os
777-
| ^^
778-
|
779-
help: Remove unused import: `os`
780-
::: cell 1
781-
1 | # cell 1
782-
- import os
783-
::: cell 2
784-
1 | # cell 2
785-
- import math
786-
2 |
787-
3 | print('hello world')
788-
::: cell 3
789-
1 | # cell 3
790-
2 | def foo():
791-
3 | print()
792-
- x = 1
793-
4 |
794-
note: This is an unsafe fix and may change runtime behavior
795-
");
727+
insta::assert_snapshot!(env.render(&diagnostic));
796728
}
797729

798730
/// Carriage return (`\r`) is a valid line-ending in Python, so we should normalize this to a
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
source: crates/ruff_db/src/diagnostic/render/full.rs
3+
expression: env.render_diagnostics(&diagnostics)
4+
---
5+
error[unused-import][*]: `os` imported but unused
6+
--> notebook.ipynb:cell 1:2:8
7+
|
8+
1 | # cell 1
9+
2 | import os
10+
| ^^
11+
|
12+
help: Remove unused import: `os`
13+
::: cell 1
14+
1 | # cell 1
15+
- import os
16+
17+
error[unused-import][*]: `math` imported but unused
18+
--> notebook.ipynb:cell 2:2:8
19+
|
20+
1 | # cell 2
21+
2 | import math
22+
| ^^^^
23+
3 |
24+
4 | print('hello world')
25+
|
26+
help: Remove unused import: `math`
27+
::: cell 2
28+
1 | # cell 2
29+
- import math
30+
2 |
31+
3 | print('hello world')
32+
33+
error[unused-variable][*]: Local variable `x` is assigned to but never used
34+
--> notebook.ipynb:cell 3:4:5
35+
|
36+
2 | def foo():
37+
3 | print()
38+
4 | x = 1
39+
| ^
40+
|
41+
help: Remove assignment to unused variable `x`
42+
::: cell 3
43+
1 | # cell 3
44+
2 | def foo():
45+
3 | print()
46+
- x = 1
47+
4 |
48+
note: This is an unsafe fix and may change runtime behavior

0 commit comments

Comments
 (0)