Skip to content

Commit 3cf9559

Browse files
committed
Merge branch 'main' into dcreager/infer-function-calls
* main: (30 commits) [red-knot] Silence `unresolved-import` in unreachable code (#17336) red_knot_python_semantic: move TODO comment red_knot_python_semantic: rename `lint()` and `report()` ruff_db: use `Annotation::get_message` in more places red_knot_python_semantic: tweak docs on building reporter builders red_knot_python_semantic: remove the "old" secondary message type red_knot_python_semantic: replace one use of "old" secondary diagnostic messages red_knot_python_semantic: update revealed type snapshots ruff_db: tweak how the revealed type diagnostic is rendered red_knot: add explicit test for concise `reveal_type` diagnostic red_knot_python_semantic: remove `InferContext::report_diagnostic` red_knot_python_semantic: add "reporter" API Bump 0.11.5 (#17337) [red-knot] Silence `unresolved-attribute` in unreachable code (#17305) Revert "[red-knot] Type narrowing for assertions (#17149)" (#17335) [red-knot] Type narrowing for assertions (#17149) [red-knot] avoid unnecessary evaluation of visibility constraint on definitely-unbound symbol (#17326) update cargo-dist (#17325) [red-knot] Fix double hovers/inlays in playground (#17334) [red-knot] Track reachability of scopes (#17332) ...
2 parents 1f67883 + 8b2727c commit 3cf9559

140 files changed

Lines changed: 3307 additions & 1947 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/release.yml

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# This file was autogenerated by dist: https://github.com/astral-sh/cargo-dist
22
#
3+
# Copyright 2022-2024, axodotdev
34
# Copyright 2025 Astral Software Inc.
45
# SPDX-License-Identifier: MIT or Apache-2.0
56
#
@@ -59,16 +60,17 @@ jobs:
5960
env:
6061
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6162
steps:
62-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
63+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
6364
with:
65+
persist-credentials: false
6466
submodules: recursive
6567
- name: Install dist
6668
# we specify bash to get pipefail; it guards against the `curl` command
6769
# failing. otherwise `sh` won't catch that `curl` returned non-0
6870
shell: bash
69-
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/astral-sh/cargo-dist/releases/download/v0.28.3/cargo-dist-installer.sh | sh"
71+
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/astral-sh/cargo-dist/releases/download/v0.28.4-prerelease.1/cargo-dist-installer.sh | sh"
7072
- name: Cache dist
71-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
73+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
7274
with:
7375
name: cargo-dist-cache
7476
path: ~/.cargo/bin/dist
@@ -84,7 +86,7 @@ jobs:
8486
cat plan-dist-manifest.json
8587
echo "manifest=$(jq -c "." plan-dist-manifest.json)" >> "$GITHUB_OUTPUT"
8688
- name: "Upload dist-manifest.json"
87-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
89+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
8890
with:
8991
name: artifacts-plan-dist-manifest
9092
path: plan-dist-manifest.json
@@ -121,18 +123,19 @@ jobs:
121123
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
122124
BUILD_MANIFEST_NAME: target/distrib/global-dist-manifest.json
123125
steps:
124-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
126+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
125127
with:
128+
persist-credentials: false
126129
submodules: recursive
127130
- name: Install cached dist
128-
uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
131+
uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e
129132
with:
130133
name: cargo-dist-cache
131134
path: ~/.cargo/bin/
132135
- run: chmod +x ~/.cargo/bin/dist
133136
# Get all the local artifacts for the global tasks to use (for e.g. checksums)
134137
- name: Fetch local artifacts
135-
uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
138+
uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e
136139
with:
137140
pattern: artifacts-*
138141
path: target/distrib/
@@ -150,7 +153,7 @@ jobs:
150153
151154
cp dist-manifest.json "$BUILD_MANIFEST_NAME"
152155
- name: "Upload artifacts"
153-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
156+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
154157
with:
155158
name: artifacts-build-global
156159
path: |
@@ -171,18 +174,19 @@ jobs:
171174
outputs:
172175
val: ${{ steps.host.outputs.manifest }}
173176
steps:
174-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
177+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
175178
with:
179+
persist-credentials: false
176180
submodules: recursive
177181
- name: Install cached dist
178-
uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
182+
uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e
179183
with:
180184
name: cargo-dist-cache
181185
path: ~/.cargo/bin/
182186
- run: chmod +x ~/.cargo/bin/dist
183187
# Fetch artifacts from scratch-storage
184188
- name: Fetch artifacts
185-
uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
189+
uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e
186190
with:
187191
pattern: artifacts-*
188192
path: target/distrib/
@@ -196,7 +200,7 @@ jobs:
196200
cat dist-manifest.json
197201
echo "manifest=$(jq -c "." dist-manifest.json)" >> "$GITHUB_OUTPUT"
198202
- name: "Upload dist-manifest.json"
199-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
203+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
200204
with:
201205
# Overwrite the previous copy
202206
name: artifacts-dist-manifest
@@ -246,12 +250,13 @@ jobs:
246250
env:
247251
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
248252
steps:
249-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
253+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
250254
with:
255+
persist-credentials: false
251256
submodules: recursive
252257
# Create a GitHub Release while uploading all files to it
253258
- name: "Download GitHub Artifacts"
254-
uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
259+
uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e
255260
with:
256261
pattern: artifacts-*
257262
path: artifacts

.pre-commit-config.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ exclude: |
1818
)$
1919
2020
repos:
21+
- repo: https://github.com/pre-commit/pre-commit-hooks
22+
rev: v5.0.0
23+
hooks:
24+
- id: check-merge-conflict
25+
2126
- repo: https://github.com/abravalheri/validate-pyproject
2227
rev: v0.24.1
2328
hooks:

CHANGELOG.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,30 @@
11
# Changelog
22

3+
## 0.11.5
4+
5+
### Preview features
6+
7+
- \[`airflow`\] Add missing `AIR302` attribute check ([#17115](https://github.com/astral-sh/ruff/pull/17115))
8+
- \[`airflow`\] Expand module path check to individual symbols (`AIR302`) ([#17278](https://github.com/astral-sh/ruff/pull/17278))
9+
- \[`airflow`\] Extract `AIR312` from `AIR302` rules (`AIR302`, `AIR312`) ([#17152](https://github.com/astral-sh/ruff/pull/17152))
10+
- \[`airflow`\] Update oudated `AIR301`, `AIR302` rules ([#17123](https://github.com/astral-sh/ruff/pull/17123))
11+
- [syntax-errors] Async comprehension in sync comprehension ([#17177](https://github.com/astral-sh/ruff/pull/17177))
12+
- [syntax-errors] Check annotations in annotated assignments ([#17283](https://github.com/astral-sh/ruff/pull/17283))
13+
- [syntax-errors] Extend annotation checks to `await` ([#17282](https://github.com/astral-sh/ruff/pull/17282))
14+
15+
### Bug fixes
16+
17+
- \[`flake8-pie`\] Avoid false positive for multiple assignment with `auto()` (`PIE796`) ([#17274](https://github.com/astral-sh/ruff/pull/17274))
18+
19+
### Rule changes
20+
21+
- \[`ruff`\] Fix `RUF100` to detect unused file-level `noqa` directives with specific codes (#17042) ([#17061](https://github.com/astral-sh/ruff/pull/17061))
22+
- \[`flake8-pytest-style`\] Avoid false positive for legacy form of `pytest.raises` (`PT011`) ([#17231](https://github.com/astral-sh/ruff/pull/17231))
23+
24+
### Documentation
25+
26+
- Fix formatting of "See Style Guide" link ([#17272](https://github.com/astral-sh/ruff/pull/17272))
27+
328
## 0.11.4
429

530
### Preview features

Cargo.lock

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

Cargo.toml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ rayon = { version = "1.10.0" }
124124
regex = { version = "1.10.2" }
125125
rustc-hash = { version = "2.0.0" }
126126
# When updating salsa, make sure to also update the revision in `fuzz/Cargo.toml`
127-
salsa = { git = "https://github.com/salsa-rs/salsa.git", rev = "296a8c78da1b54c76ff5795eb4c1e3fe2467e9fc" }
127+
salsa = { git = "https://github.com/salsa-rs/salsa.git", rev = "87bf6b6c2d5f6479741271da73bd9d30c2580c26" }
128128
schemars = { version = "0.8.16" }
129129
seahash = { version = "4.1.0" }
130130
serde = { version = "1.0.197", features = ["derive"] }
@@ -272,7 +272,7 @@ inherits = "release"
272272
# Config for 'dist'
273273
[workspace.metadata.dist]
274274
# The preferred dist version to use in CI (Cargo.toml SemVer syntax)
275-
cargo-dist-version = "0.28.3"
275+
cargo-dist-version = "0.28.4-prerelease.1"
276276
# CI backends to support
277277
ci = "github"
278278
# The installers to generate for each app
@@ -329,9 +329,12 @@ github-custom-job-permissions = { "build-docker" = { packages = "write", content
329329
install-updater = false
330330
# Path that installers should place binaries in
331331
install-path = ["$XDG_BIN_HOME/", "$XDG_DATA_HOME/../bin", "~/.local/bin"]
332-
# Temporarily allow changes to the `release` workflow, in which we pin actions
333-
# to a SHA instead of a tag (https://github.com/astral-sh/uv/issues/12253)
334-
allow-dirty = ["ci"]
335332

336333
[workspace.metadata.dist.github-custom-runners]
337334
global = "depot-ubuntu-latest-4"
335+
336+
[workspace.metadata.dist.github-action-commits]
337+
"actions/checkout" = "11bd71901bbe5b1630ceea73d27597364c9af683" # v4
338+
"actions/upload-artifact" = "ea165f8d65b6e75b540449e92b4886f43607fa02" # v4.6.2
339+
"actions/download-artifact" = "95815c38cf2ff2164869cbab79da8d1f422bc89e" # v4.2.1
340+
"actions/attest-build-provenance" = "c074443f1aee8d4aeeae555aebba3282517141b2" #v2.2.3

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,8 @@ curl -LsSf https://astral.sh/ruff/install.sh | sh
149149
powershell -c "irm https://astral.sh/ruff/install.ps1 | iex"
150150

151151
# For a specific version.
152-
curl -LsSf https://astral.sh/ruff/0.11.4/install.sh | sh
153-
powershell -c "irm https://astral.sh/ruff/0.11.4/install.ps1 | iex"
152+
curl -LsSf https://astral.sh/ruff/0.11.5/install.sh | sh
153+
powershell -c "irm https://astral.sh/ruff/0.11.5/install.ps1 | iex"
154154
```
155155

156156
You can also install Ruff via [Homebrew](https://formulae.brew.sh/formula/ruff), [Conda](https://anaconda.org/conda-forge/ruff),
@@ -183,7 +183,7 @@ Ruff can also be used as a [pre-commit](https://pre-commit.com/) hook via [`ruff
183183
```yaml
184184
- repo: https://github.com/astral-sh/ruff-pre-commit
185185
# Ruff version.
186-
rev: v0.11.4
186+
rev: v0.11.5
187187
hooks:
188188
# Run the linter.
189189
- id: ruff

crates/red_knot/tests/cli.rs

Lines changed: 41 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,13 @@ fn config_override_python_platform() -> anyhow::Result<()> {
8383
success: true
8484
exit_code: 0
8585
----- stdout -----
86-
info: revealed-type
86+
info: revealed-type: Revealed type
8787
--> <temp_dir>/test.py:5:1
8888
|
8989
3 | from typing_extensions import reveal_type
9090
4 |
9191
5 | reveal_type(sys.platform)
92-
| ^^^^^^^^^^^^^^^^^^^^^^^^^ Revealed type is `Literal["linux"]`
92+
| ^^^^^^^^^^^^^^^^^^^^^^^^^ `Literal["linux"]`
9393
|
9494
9595
Found 1 diagnostic
@@ -101,13 +101,13 @@ fn config_override_python_platform() -> anyhow::Result<()> {
101101
success: true
102102
exit_code: 0
103103
----- stdout -----
104-
info: revealed-type
104+
info: revealed-type: Revealed type
105105
--> <temp_dir>/test.py:5:1
106106
|
107107
3 | from typing_extensions import reveal_type
108108
4 |
109109
5 | reveal_type(sys.platform)
110-
| ^^^^^^^^^^^^^^^^^^^^^^^^^ Revealed type is `LiteralString`
110+
| ^^^^^^^^^^^^^^^^^^^^^^^^^ `LiteralString`
111111
|
112112
113113
Found 1 diagnostic
@@ -584,12 +584,12 @@ fn exit_code_only_info() -> anyhow::Result<()> {
584584
success: true
585585
exit_code: 0
586586
----- stdout -----
587-
info: revealed-type
587+
info: revealed-type: Revealed type
588588
--> <temp_dir>/test.py:3:1
589589
|
590590
2 | from typing_extensions import reveal_type
591591
3 | reveal_type(1)
592-
| ^^^^^^^^^^^^^^ Revealed type is `Literal[1]`
592+
| ^^^^^^^^^^^^^^ `Literal[1]`
593593
|
594594
595595
Found 1 diagnostic
@@ -614,12 +614,12 @@ fn exit_code_only_info_and_error_on_warning_is_true() -> anyhow::Result<()> {
614614
success: true
615615
exit_code: 0
616616
----- stdout -----
617-
info: revealed-type
617+
info: revealed-type: Revealed type
618618
--> <temp_dir>/test.py:3:1
619619
|
620620
2 | from typing_extensions import reveal_type
621621
3 | reveal_type(1)
622-
| ^^^^^^^^^^^^^^ Revealed type is `Literal[1]`
622+
| ^^^^^^^^^^^^^^ `Literal[1]`
623623
|
624624
625625
Found 1 diagnostic
@@ -1052,6 +1052,39 @@ fn concise_diagnostics() -> anyhow::Result<()> {
10521052
Ok(())
10531053
}
10541054

1055+
/// This tests the diagnostic format for revealed type.
1056+
///
1057+
/// This test was introduced because changes were made to
1058+
/// how the revealed type diagnostic was constructed and
1059+
/// formatted in "verbose" mode. But it required extra
1060+
/// logic to ensure the concise version didn't regress on
1061+
/// information content. So this test was introduced to
1062+
/// capture that.
1063+
#[test]
1064+
fn concise_revealed_type() -> anyhow::Result<()> {
1065+
let case = TestCase::with_file(
1066+
"test.py",
1067+
r#"
1068+
from typing_extensions import reveal_type
1069+
1070+
x = "hello"
1071+
reveal_type(x)
1072+
"#,
1073+
)?;
1074+
1075+
assert_cmd_snapshot!(case.command().arg("--output-format=concise"), @r#"
1076+
success: true
1077+
exit_code: 0
1078+
----- stdout -----
1079+
info[revealed-type] <temp_dir>/test.py:5:1: Revealed type: `Literal["hello"]`
1080+
Found 1 diagnostic
1081+
1082+
----- stderr -----
1083+
"#);
1084+
1085+
Ok(())
1086+
}
1087+
10551088
struct TestCase {
10561089
_temp_dir: TempDir,
10571090
_settings_scope: SettingsBindDropGuard,

0 commit comments

Comments
 (0)