diff --git a/crates/ruff_linter/src/rules/flake8_builtins/rules/stdlib_module_shadowing.rs b/crates/ruff_linter/src/rules/flake8_builtins/rules/stdlib_module_shadowing.rs index 88588714ff..9225637e8d 100644 --- a/crates/ruff_linter/src/rules/flake8_builtins/rules/stdlib_module_shadowing.rs +++ b/crates/ruff_linter/src/rules/flake8_builtins/rules/stdlib_module_shadowing.rs @@ -27,6 +27,20 @@ use crate::settings::types::PythonVersion; /// of the control of the author of the stub file. Instead, a stub should aim to /// faithfully emulate the runtime module it is stubbing. /// +/// As of Python 3.13, errors from modules that use the same name as +/// standard-library modules now display a custom message. +/// +/// ## Example +/// +/// ```console +/// $ touch random.py +/// $ python3 -c 'from random import choice' +/// Traceback (most recent call last): +/// File "", line 1, in +/// from random import choice +/// ImportError: cannot import name 'choice' from 'random' (consider renaming '/random.py' since it has the same name as the standard library module named 'random' and prevents importing that standard library module) +/// ``` +/// /// ## Options /// - `lint.flake8-builtins.builtins-allowed-modules` #[derive(ViolationMetadata)] diff --git a/crates/ruff_workspace/src/options.rs b/crates/ruff_workspace/src/options.rs index 9236dedd3f..de18d2a42a 100644 --- a/crates/ruff_workspace/src/options.rs +++ b/crates/ruff_workspace/src/options.rs @@ -1127,7 +1127,7 @@ pub struct Flake8BuiltinsOptions { #[option( default = r#"[]"#, value_type = "list[str]", - example = "builtins-allowed-modules = [\"id\"]" + example = "builtins-allowed-modules = [\"secrets\"]" )] /// List of builtin module names to allow. pub builtins_allowed_modules: Option>,