Skip to content

Commit 51becee

Browse files
committed
[flake8-builtins] Update documentation (A005)
Follow-up to #15951 to update * the options links in A005 to reference `lint.flake8-builtins.builtins-strict-checking` * the description of the rule to explain strict vs non-strict checking * the option documentation to point back to the rule
1 parent df1d430 commit 51becee

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

crates/ruff_linter/src/rules/flake8_builtins/rules/stdlib_module_shadowing.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ use crate::settings::LinterSettings;
2323
/// Standard-library modules can be marked as exceptions to this rule via the
2424
/// [`lint.flake8-builtins.builtins-allowed-modules`] configuration option.
2525
///
26+
/// By default, only the last component of the module name is considered, so `logging.py`,
27+
/// `a/logging.py`, `a/b/logging.py`, and so on would all clash with the builtin `logging` module.
28+
/// With the [`lint.flake8-builtins.builtins-strict-checking`] option set to `false`, the module
29+
/// path is considered, so only a top-level `logging.py` or `logging/__init__.py` will trigger the
30+
/// rule and `utils/logging.py`, for example, would not.
31+
///
2632
/// This rule is not applied to stub files, as the name of a stub module is out
2733
/// of the control of the author of the stub file. Instead, a stub should aim to
2834
/// faithfully emulate the runtime module it is stubbing.
@@ -43,6 +49,7 @@ use crate::settings::LinterSettings;
4349
///
4450
/// ## Options
4551
/// - `lint.flake8-builtins.builtins-allowed-modules`
52+
/// - `lint.flake8-builtins.builtins-strict-checking`
4653
#[derive(ViolationMetadata)]
4754
pub(crate) struct StdlibModuleShadowing {
4855
name: String,

crates/ruff_workspace/src/options.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,6 +1149,8 @@ pub struct Flake8BuiltinsOptions {
11491149
example = "builtins-strict-checking = false"
11501150
)]
11511151
/// Compare module names instead of full module paths.
1152+
///
1153+
/// Used by [`A005` - `stdlib-module-shadowing`](https://docs.astral.sh/ruff/rules/stdlib-module-shadowing/).
11521154
pub builtins_strict_checking: Option<bool>,
11531155
}
11541156

0 commit comments

Comments
 (0)