Skip to content

Commit 183ecab

Browse files
committed
better error message
1 parent 47ae15f commit 183ecab

2 files changed

Lines changed: 2 additions & 3 deletions

File tree

crates/ruff_linter/src/rules/pyflakes/rules/undefined_name.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ impl Violation for UndefinedName {
4040
} = self;
4141
let tip = minor_version_builtin_added.map(|version_added| {
4242
format!(
43-
"Added as a builtin in Python 3.{version_added}; \
44-
consider specifying a newer `target-version` in your Ruff config."
43+
r#"Consider specifying `requires-python = ">= 3.{version_added}"` or `tool.ruff.target-version = "py3{version_added}"` in your `pyproject.toml` file."#
4544
)
4645
});
4746

crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__f821_with_builtin_added_on_new_py_version_but_old_target_version_specified.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
source: crates/ruff_linter/src/rules/pyflakes/mod.rs
33
---
4-
<filename>:1:1: F821 Undefined name `PythonFinalizationError`. Added as a builtin in Python 3.13; consider specifying a newer `target-version` in your Ruff config.
4+
<filename>:1:1: F821 Undefined name `PythonFinalizationError`. Consider specifying `requires-python = ">= 3.13"` or `tool.ruff.target-version = "py313"` in your `pyproject.toml` file.
55
|
66
1 | PythonFinalizationError
77
| ^^^^^^^^^^^^^^^^^^^^^^^ F821

0 commit comments

Comments
 (0)