Skip to content

Commit cc66536

Browse files
committed
Merge remote-tracking branch 'origin/main' into dcreager/satisfies
* origin/main: [ty] Fix generic inference for non-dataclass inheriting from generic dataclass (#21159) Update etcetera to 0.11.0 (#21160) Fix missing diagnostics for notebooks (#21156) [ty] Fix tests for definition completions (#21153) Bump v0.14.3 (#21152) [ty] Don't provide completions when in class or function definition (#21146) [ty] Use the top materialization of classes for narrowing in class-patterns for `match` statements (#21150)
2 parents 587dae6 + 735ec0c commit cc66536

File tree

26 files changed

+385
-86
lines changed

26 files changed

+385
-86
lines changed

CHANGELOG.md

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

3+
## 0.14.3
4+
5+
Released on 2025-10-30.
6+
7+
### Preview features
8+
9+
- Respect `--output-format` with `--watch` ([#21097](https://github.com/astral-sh/ruff/pull/21097))
10+
- \[`pydoclint`\] Fix false positive on explicit exception re-raising (`DOC501`, `DOC502`) ([#21011](https://github.com/astral-sh/ruff/pull/21011))
11+
- \[`pyflakes`\] Revert to stable behavior if imports for module lie in alternate branches for `F401` ([#20878](https://github.com/astral-sh/ruff/pull/20878))
12+
- \[`pylint`\] Implement `stop-iteration-return` (`PLR1708`) ([#20733](https://github.com/astral-sh/ruff/pull/20733))
13+
- \[`ruff`\] Add support for additional eager conversion patterns (`RUF065`) ([#20657](https://github.com/astral-sh/ruff/pull/20657))
14+
15+
### Bug fixes
16+
17+
- Fix finding keyword range for clause header after statement ending with semicolon ([#21067](https://github.com/astral-sh/ruff/pull/21067))
18+
- Fix syntax error false positive on nested alternative patterns ([#21104](https://github.com/astral-sh/ruff/pull/21104))
19+
- \[`ISC001`\] Fix panic when string literals are unclosed ([#21034](https://github.com/astral-sh/ruff/pull/21034))
20+
- \[`flake8-django`\] Apply `DJ001` to annotated fields ([#20907](https://github.com/astral-sh/ruff/pull/20907))
21+
- \[`flake8-pyi`\] Fix `PYI034` to not trigger on metaclasses (`PYI034`) ([#20881](https://github.com/astral-sh/ruff/pull/20881))
22+
- \[`flake8-type-checking`\] Fix `TC003` false positive with `future-annotations` ([#21125](https://github.com/astral-sh/ruff/pull/21125))
23+
- \[`pyflakes`\] Fix false positive for `__class__` in lambda expressions within class definitions (`F821`) ([#20564](https://github.com/astral-sh/ruff/pull/20564))
24+
- \[`pyupgrade`\] Fix false positive for `TypeVar` with default on Python \<3.13 (`UP046`,`UP047`) ([#21045](https://github.com/astral-sh/ruff/pull/21045))
25+
26+
### Rule changes
27+
28+
- Add missing docstring sections to the numpy list ([#20931](https://github.com/astral-sh/ruff/pull/20931))
29+
- \[`airflow`\] Extend `airflow.models..Param` check (`AIR311`) ([#21043](https://github.com/astral-sh/ruff/pull/21043))
30+
- \[`airflow`\] Warn that `airflow....DAG.create_dagrun` has been removed (`AIR301`) ([#21093](https://github.com/astral-sh/ruff/pull/21093))
31+
- \[`refurb`\] Preserve digit separators in `Decimal` constructor (`FURB157`) ([#20588](https://github.com/astral-sh/ruff/pull/20588))
32+
33+
### Server
34+
35+
- Avoid sending an unnecessary "clear diagnostics" message for clients supporting pull diagnostics ([#21105](https://github.com/astral-sh/ruff/pull/21105))
36+
37+
### Documentation
38+
39+
- \[`flake8-bandit`\] Fix correct example for `S308` ([#21128](https://github.com/astral-sh/ruff/pull/21128))
40+
41+
### Other changes
42+
43+
- Clearer error message when `line-length` goes beyond threshold ([#21072](https://github.com/astral-sh/ruff/pull/21072))
44+
45+
### Contributors
46+
47+
- [@danparizher](https://github.com/danparizher)
48+
- [@jvacek](https://github.com/jvacek)
49+
- [@ntBre](https://github.com/ntBre)
50+
- [@augustelalande](https://github.com/augustelalande)
51+
- [@prakhar1144](https://github.com/prakhar1144)
52+
- [@TaKO8Ki](https://github.com/TaKO8Ki)
53+
- [@dylwil3](https://github.com/dylwil3)
54+
- [@fatelei](https://github.com/fatelei)
55+
- [@ShaharNaveh](https://github.com/ShaharNaveh)
56+
- [@Lee-W](https://github.com/Lee-W)
57+
358
## 0.14.2
459

560
Released on 2025-10-23.

Cargo.lock

Lines changed: 17 additions & 27 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 & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ dashmap = { version = "6.0.1" }
8484
dir-test = { version = "0.4.0" }
8585
dunce = { version = "1.0.5" }
8686
drop_bomb = { version = "0.1.5" }
87-
etcetera = { version = "0.10.0" }
87+
etcetera = { version = "0.11.0" }
8888
fern = { version = "0.7.0" }
8989
filetime = { version = "0.2.23" }
9090
getrandom = { version = "0.3.1" }

README.md

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

149149
# For a specific version.
150-
curl -LsSf https://astral.sh/ruff/0.14.2/install.sh | sh
151-
powershell -c "irm https://astral.sh/ruff/0.14.2/install.ps1 | iex"
150+
curl -LsSf https://astral.sh/ruff/0.14.3/install.sh | sh
151+
powershell -c "irm https://astral.sh/ruff/0.14.3/install.ps1 | iex"
152152
```
153153

154154
You can also install Ruff via [Homebrew](https://formulae.brew.sh/formula/ruff), [Conda](https://anaconda.org/conda-forge/ruff),
@@ -181,7 +181,7 @@ Ruff can also be used as a [pre-commit](https://pre-commit.com/) hook via [`ruff
181181
```yaml
182182
- repo: https://github.com/astral-sh/ruff-pre-commit
183183
# Ruff version.
184-
rev: v0.14.2
184+
rev: v0.14.3
185185
hooks:
186186
# Run the linter.
187187
- id: ruff-check

crates/ruff/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ruff"
3-
version = "0.14.2"
3+
version = "0.14.3"
44
publish = true
55
authors = { workspace = true }
66
edition = { workspace = true }

crates/ruff_linter/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ruff_linter"
3-
version = "0.14.2"
3+
version = "0.14.3"
44
publish = false
55
authors = { workspace = true }
66
edition = { workspace = true }

crates/ruff_server/src/server/api/diagnostics.rs

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
use lsp_types::Url;
2-
31
use crate::{
4-
Session,
52
lint::DiagnosticsMap,
63
session::{Client, DocumentQuery, DocumentSnapshot},
74
};
@@ -22,21 +19,10 @@ pub(super) fn generate_diagnostics(snapshot: &DocumentSnapshot) -> DiagnosticsMa
2219
}
2320

2421
pub(super) fn publish_diagnostics_for_document(
25-
session: &Session,
26-
url: &Url,
22+
snapshot: &DocumentSnapshot,
2723
client: &Client,
2824
) -> crate::server::Result<()> {
29-
// Publish diagnostics if the client doesn't support pull diagnostics
30-
if session.resolved_client_capabilities().pull_diagnostics {
31-
return Ok(());
32-
}
33-
34-
let snapshot = session
35-
.take_snapshot(url.clone())
36-
.ok_or_else(|| anyhow::anyhow!("Unable to take snapshot for document with URL {url}"))
37-
.with_failure_code(lsp_server::ErrorCode::InternalError)?;
38-
39-
for (uri, diagnostics) in generate_diagnostics(&snapshot) {
25+
for (uri, diagnostics) in generate_diagnostics(snapshot) {
4026
client
4127
.send_notification::<lsp_types::notification::PublishDiagnostics>(
4228
lsp_types::PublishDiagnosticsParams {
@@ -52,14 +38,9 @@ pub(super) fn publish_diagnostics_for_document(
5238
}
5339

5440
pub(super) fn clear_diagnostics_for_document(
55-
session: &Session,
5641
query: &DocumentQuery,
5742
client: &Client,
5843
) -> crate::server::Result<()> {
59-
if session.resolved_client_capabilities().pull_diagnostics {
60-
return Ok(());
61-
}
62-
6344
client
6445
.send_notification::<lsp_types::notification::PublishDiagnostics>(
6546
lsp_types::PublishDiagnosticsParams {

crates/ruff_server/src/server/api/notifications/did_change.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@ impl super::SyncNotificationHandler for DidChange {
3131
.update_text_document(&key, content_changes, new_version)
3232
.with_failure_code(ErrorCode::InternalError)?;
3333

34-
publish_diagnostics_for_document(session, &key.into_url(), client)?;
34+
// Publish diagnostics if the client doesn't support pull diagnostics
35+
if !session.resolved_client_capabilities().pull_diagnostics {
36+
let snapshot = session.take_snapshot(key.into_url()).unwrap();
37+
publish_diagnostics_for_document(&snapshot, client)?;
38+
}
3539

3640
Ok(())
3741
}

crates/ruff_server/src/server/api/notifications/did_change_notebook.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ impl super::SyncNotificationHandler for DidChangeNotebook {
2727
.with_failure_code(ErrorCode::InternalError)?;
2828

2929
// publish new diagnostics
30-
publish_diagnostics_for_document(session, &key.into_url(), client)?;
30+
let snapshot = session
31+
.take_snapshot(key.into_url())
32+
.expect("snapshot should be available");
33+
publish_diagnostics_for_document(&snapshot, client)?;
3134

3235
Ok(())
3336
}

crates/ruff_server/src/server/api/notifications/did_change_watched_files.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,19 @@ impl super::SyncNotificationHandler for DidChangeWatchedFiles {
3131
} else {
3232
// publish diagnostics for text documents
3333
for url in session.text_document_urls() {
34-
publish_diagnostics_for_document(session, url, client)?;
34+
let snapshot = session
35+
.take_snapshot(url.clone())
36+
.expect("snapshot should be available");
37+
publish_diagnostics_for_document(&snapshot, client)?;
3538
}
3639
}
3740

3841
// always publish diagnostics for notebook files (since they don't use pull diagnostics)
3942
for url in session.notebook_document_urls() {
40-
publish_diagnostics_for_document(session, url, client)?;
43+
let snapshot = session
44+
.take_snapshot(url.clone())
45+
.expect("snapshot should be available");
46+
publish_diagnostics_for_document(&snapshot, client)?;
4147
}
4248
}
4349

0 commit comments

Comments
 (0)