Skip to content

Commit 407f7bb

Browse files
committed
Merge remote-tracking branch 'origin/main' into dcreager/non-inherited
* origin/main: [`flake8-bugbear`] Include certain guaranteed-mutable expressions: tuples, generators, and assignment expressions (`B006`) (#20024) [`flake8-comprehensions`] Clarify fix safety documentation (`C413`) (#20640) [ty] improve base conda distinction from child conda (#20675) [`ruff`] Extend FA102 with listed PEP 585-compatible APIs (#20659) [`ruff`] Handle argfile expansion errors gracefully (#20691) [`flynt`] Fix f-string quoting for mixed quote joiners (`FLY002`) (#20662) [ty] Fix file root matching for `/` [ruff,ty] Enable tracing's `log` feature [`flake8-annotations`] Fix return type annotations to handle shadowed builtin symbols (`ANN201`, `ANN202`, `ANN204`, `ANN205`, `ANN206`) (#20612) Bump 0.13.3 (#20685) Update benchmarking CI for cargo-codspeed v4 (#20686) [ty] Support single-starred argument for overload call (#20223) [ty] `~T` should never be assignable to `T` (#20606) [`pylint`] Clarify fix safety to include left-hand hashability (`PLR6201`) (#20518) [ty] No union with `Unknown` for module-global symbols (#20664) [`ty`] Reject renaming files to start with slash in Playground (#20666) [ty] Enums: allow multiple aliases to point to the same member (#20669)
2 parents 8abcebf + 673167a commit 407f7bb

File tree

78 files changed

+3225
-369
lines changed

Some content is hidden

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

78 files changed

+3225
-369
lines changed

.github/workflows/ci.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -932,7 +932,7 @@ jobs:
932932
tool: cargo-codspeed
933933

934934
- name: "Build benchmarks"
935-
run: cargo codspeed build --features "codspeed,instrumented" --no-default-features -p ruff_benchmark formatter lexer linter parser
935+
run: cargo codspeed build --features "codspeed,instrumented" --no-default-features -p ruff_benchmark --bench formatter --bench lexer --bench linter --bench parser
936936

937937
- name: "Run benchmarks"
938938
uses: CodSpeedHQ/action@653fdc30e6c40ffd9739e40c8a0576f4f4523ca1 # v4.0.1
@@ -967,7 +967,7 @@ jobs:
967967
tool: cargo-codspeed
968968

969969
- name: "Build benchmarks"
970-
run: cargo codspeed build --features "codspeed,instrumented" --no-default-features -p ruff_benchmark ty
970+
run: cargo codspeed build --features "codspeed,instrumented" --no-default-features -p ruff_benchmark --bench ty
971971

972972
- name: "Run benchmarks"
973973
uses: CodSpeedHQ/action@653fdc30e6c40ffd9739e40c8a0576f4f4523ca1 # v4.0.1

CHANGELOG.md

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

3+
## 0.13.3
4+
5+
Released on 2025-10-02.
6+
7+
### Preview features
8+
9+
- Display diffs for `ruff format --check` and add support for different output formats ([#20443](https://github.com/astral-sh/ruff/pull/20443))
10+
- \[`pyflakes`\] Handle some common submodule import situations for `unused-import` (`F401`) ([#20200](https://github.com/astral-sh/ruff/pull/20200))
11+
- \[`ruff`\] Do not flag `%r` + `repr()` combinations (`RUF065`) ([#20600](https://github.com/astral-sh/ruff/pull/20600))
12+
13+
### Bug fixes
14+
15+
- \[`cli`\] Add conflict between `--add-noqa` and `--diff` options ([#20642](https://github.com/astral-sh/ruff/pull/20642))
16+
- \[`pylint`\] Exempt required imports from `PLR0402` ([#20381](https://github.com/astral-sh/ruff/pull/20381))
17+
- \[`pylint`\] Fix missing `max-nested-blocks` in settings display ([#20574](https://github.com/astral-sh/ruff/pull/20574))
18+
- \[`pyupgrade`\] Prevent infinite loop with `I002` and `UP026` ([#20634](https://github.com/astral-sh/ruff/pull/20634))
19+
20+
### Rule changes
21+
22+
- \[`flake8-simplify`\] Improve help message clarity (`SIM105`) ([#20548](https://github.com/astral-sh/ruff/pull/20548))
23+
24+
### Documentation
25+
26+
- Add the *The Basics* title back to CONTRIBUTING.md ([#20624](https://github.com/astral-sh/ruff/pull/20624))
27+
- Fixed documentation for try_consider_else ([#20587](https://github.com/astral-sh/ruff/pull/20587))
28+
- \[`isort`\] Clarify dependency between `order-by-type` and `case-sensitive` settings ([#20559](https://github.com/astral-sh/ruff/pull/20559))
29+
- \[`pylint`\] Clarify fix safety to include left-hand hashability (`PLR6201`) ([#20518](https://github.com/astral-sh/ruff/pull/20518))
30+
31+
### Other changes
32+
33+
- \[`playground`\] Fix quick fixes for empty ranges in playground ([#20599](https://github.com/astral-sh/ruff/pull/20599))
34+
35+
### Contributors
36+
37+
- [@TaKO8Ki](https://github.com/TaKO8Ki)
38+
- [@ntBre](https://github.com/ntBre)
39+
- [@dylwil3](https://github.com/dylwil3)
40+
- [@MichaReiser](https://github.com/MichaReiser)
41+
- [@danparizher](https://github.com/danparizher)
42+
- [@LilMonk](https://github.com/LilMonk)
43+
- [@mgiovani](https://github.com/mgiovani)
44+
- [@IDrokin117](https://github.com/IDrokin117)
45+
346
## 0.13.2
447

548
Released on 2025-09-25.

Cargo.lock

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

README.md

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

150150
# For a specific version.
151-
curl -LsSf https://astral.sh/ruff/0.13.2/install.sh | sh
152-
powershell -c "irm https://astral.sh/ruff/0.13.2/install.ps1 | iex"
151+
curl -LsSf https://astral.sh/ruff/0.13.3/install.sh | sh
152+
powershell -c "irm https://astral.sh/ruff/0.13.3/install.ps1 | iex"
153153
```
154154

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

_typos.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ extend-ignore-re = [
3131
"typ",
3232
# TODO: Remove this once the `TYP` redirects are removed from `rule_redirects.rs`
3333
"TYP",
34+
"ntBre"
3435
]
3536

3637
[default.extend-identifiers]

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.13.2"
3+
version = "0.13.3"
44
publish = true
55
authors = { workspace = true }
66
edition = { workspace = true }

crates/ruff/src/main.rs

Lines changed: 33 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use std::io::Write;
22
use std::process::ExitCode;
33

4+
use anyhow::Context;
45
use clap::Parser;
56
use colored::Colorize;
67

@@ -39,39 +40,46 @@ pub fn main() -> ExitCode {
3940
}
4041

4142
let args = wild::args_os();
42-
let args = argfile::expand_args_from(args, argfile::parse_fromfile, argfile::PREFIX).unwrap();
43+
let args = match argfile::expand_args_from(args, argfile::parse_fromfile, argfile::PREFIX)
44+
.context("Failed to read CLI arguments from files")
45+
{
46+
Ok(args) => args,
47+
Err(err) => return report_error(&err),
48+
};
4349

4450
let args = Args::parse_from(args);
4551

4652
match run(args) {
4753
Ok(code) => code.into(),
48-
Err(err) => {
49-
{
50-
// Exit "gracefully" on broken pipe errors.
51-
//
52-
// See: https://github.com/BurntSushi/ripgrep/blob/bf63fe8f258afc09bae6caa48f0ae35eaf115005/crates/core/main.rs#L47C1-L61C14
53-
for cause in err.chain() {
54-
if let Some(ioerr) = cause.downcast_ref::<std::io::Error>() {
55-
if ioerr.kind() == std::io::ErrorKind::BrokenPipe {
56-
return ExitCode::from(0);
57-
}
58-
}
59-
}
60-
61-
// Use `writeln` instead of `eprintln` to avoid panicking when the stderr pipe is broken.
62-
let mut stderr = std::io::stderr().lock();
54+
Err(err) => report_error(&err),
55+
}
56+
}
6357

64-
// This communicates that this isn't a linter error but ruff itself hard-errored for
65-
// some reason (e.g. failed to resolve the configuration)
66-
writeln!(stderr, "{}", "ruff failed".red().bold()).ok();
67-
// Currently we generally only see one error, but e.g. with io errors when resolving
68-
// the configuration it is help to chain errors ("resolving configuration failed" ->
69-
// "failed to read file: subdir/pyproject.toml")
70-
for cause in err.chain() {
71-
writeln!(stderr, " {} {cause}", "Cause:".bold()).ok();
58+
fn report_error(err: &anyhow::Error) -> ExitCode {
59+
{
60+
// Exit "gracefully" on broken pipe errors.
61+
//
62+
// See: https://github.com/BurntSushi/ripgrep/blob/bf63fe8f258afc09bae6caa48f0ae35eaf115005/crates/core/main.rs#L47C1-L61C14
63+
for cause in err.chain() {
64+
if let Some(ioerr) = cause.downcast_ref::<std::io::Error>() {
65+
if ioerr.kind() == std::io::ErrorKind::BrokenPipe {
66+
return ExitCode::from(0);
7267
}
7368
}
74-
ExitStatus::Error.into()
69+
}
70+
71+
// Use `writeln` instead of `eprintln` to avoid panicking when the stderr pipe is broken.
72+
let mut stderr = std::io::stderr().lock();
73+
74+
// This communicates that this isn't a linter error but ruff itself hard-errored for
75+
// some reason (e.g. failed to resolve the configuration)
76+
writeln!(stderr, "{}", "ruff failed".red().bold()).ok();
77+
// Currently we generally only see one error, but e.g. with io errors when resolving
78+
// the configuration it is help to chain errors ("resolving configuration failed" ->
79+
// "failed to read file: subdir/pyproject.toml")
80+
for cause in err.chain() {
81+
writeln!(stderr, " {} {cause}", "Cause:".bold()).ok();
7582
}
7683
}
84+
ExitStatus::Error.into()
7785
}

crates/ruff/tests/integration_test.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1688,6 +1688,27 @@ fn check_input_from_argfile() -> Result<()> {
16881688
Ok(())
16891689
}
16901690

1691+
#[test]
1692+
// Regression test for https://github.com/astral-sh/ruff/issues/20655
1693+
fn missing_argfile_reports_error() {
1694+
let mut cmd = RuffCheck::default().filename("@!.txt").build();
1695+
insta::with_settings!({filters => vec![
1696+
("The system cannot find the file specified.", "No such file or directory")
1697+
]}, {
1698+
assert_cmd_snapshot!(cmd, @r"
1699+
success: false
1700+
exit_code: 2
1701+
----- stdout -----
1702+
1703+
----- stderr -----
1704+
ruff failed
1705+
Cause: Failed to read CLI arguments from files
1706+
Cause: failed to open file `!.txt`
1707+
Cause: No such file or directory (os error 2)
1708+
");
1709+
});
1710+
}
1711+
16911712
#[test]
16921713
fn check_hints_hidden_unsafe_fixes() {
16931714
let mut cmd = RuffCheck::default()

crates/ruff_db/src/files/file_root.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,10 @@ impl FileRoots {
9595
self.by_path.insert(route.clone(), root).unwrap();
9696

9797
// Insert a path that matches all subdirectories and files
98-
route.push_str("/{*filepath}");
98+
if !route.ends_with("/") {
99+
route.push('/');
100+
}
101+
route.push_str("{*filepath}");
99102

100103
self.by_path.insert(route, root).unwrap();
101104
self.roots.push(root);

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.13.2"
3+
version = "0.13.3"
44
publish = false
55
authors = { workspace = true }
66
edition = { workspace = true }

0 commit comments

Comments
 (0)