mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-26 20:09:22 +00:00
[flake8-builtins
] Update documentation (A005
) (#16097)
Follow-up to https://github.com/astral-sh/ruff/pull/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
This commit is contained in:
parent
c31352f52b
commit
f8093b65ea
3 changed files with 14 additions and 1 deletions
|
@ -23,6 +23,14 @@ use crate::settings::LinterSettings;
|
||||||
/// Standard-library modules can be marked as exceptions to this rule via the
|
/// Standard-library modules can be marked as exceptions to this rule via the
|
||||||
/// [`lint.flake8-builtins.builtins-allowed-modules`] configuration option.
|
/// [`lint.flake8-builtins.builtins-allowed-modules`] configuration option.
|
||||||
///
|
///
|
||||||
|
/// By default, only the last component of the module name is considered, so `logging.py`,
|
||||||
|
/// `utils/logging.py`, and `utils/logging/__init__.py` would all clash with the builtin `logging`
|
||||||
|
/// module. With the [`lint.flake8-builtins.builtins-strict-checking`] option set to `false`, the
|
||||||
|
/// module path is considered, so only a top-level `logging.py` or `logging/__init__.py` will
|
||||||
|
/// trigger the rule and `utils/logging.py`, for example, would not. In preview mode, the default
|
||||||
|
/// value of [`lint.flake8-builtins.builtins-strict-checking`] is `false` rather than `true` in
|
||||||
|
/// stable mode.
|
||||||
|
///
|
||||||
/// This rule is not applied to stub files, as the name of a stub module is out
|
/// This rule is not applied to stub files, as the name of a stub module is out
|
||||||
/// of the control of the author of the stub file. Instead, a stub should aim to
|
/// of the control of the author of the stub file. Instead, a stub should aim to
|
||||||
/// faithfully emulate the runtime module it is stubbing.
|
/// faithfully emulate the runtime module it is stubbing.
|
||||||
|
@ -43,6 +51,7 @@ use crate::settings::LinterSettings;
|
||||||
///
|
///
|
||||||
/// ## Options
|
/// ## Options
|
||||||
/// - `lint.flake8-builtins.builtins-allowed-modules`
|
/// - `lint.flake8-builtins.builtins-allowed-modules`
|
||||||
|
/// - `lint.flake8-builtins.builtins-strict-checking`
|
||||||
#[derive(ViolationMetadata)]
|
#[derive(ViolationMetadata)]
|
||||||
pub(crate) struct StdlibModuleShadowing {
|
pub(crate) struct StdlibModuleShadowing {
|
||||||
name: String,
|
name: String,
|
||||||
|
|
|
@ -1149,6 +1149,10 @@ pub struct Flake8BuiltinsOptions {
|
||||||
example = "builtins-strict-checking = false"
|
example = "builtins-strict-checking = false"
|
||||||
)]
|
)]
|
||||||
/// Compare module names instead of full module paths.
|
/// Compare module names instead of full module paths.
|
||||||
|
///
|
||||||
|
/// Used by [`A005` - `stdlib-module-shadowing`](https://docs.astral.sh/ruff/rules/stdlib-module-shadowing/).
|
||||||
|
///
|
||||||
|
/// In preview mode the default value is `false` rather than `true`.
|
||||||
pub builtins_strict_checking: Option<bool>,
|
pub builtins_strict_checking: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
ruff.schema.json
generated
2
ruff.schema.json
generated
|
@ -1026,7 +1026,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"builtins-strict-checking": {
|
"builtins-strict-checking": {
|
||||||
"description": "Compare module names instead of full module paths.",
|
"description": "Compare module names instead of full module paths.\n\nUsed by [`A005` - `stdlib-module-shadowing`](https://docs.astral.sh/ruff/rules/stdlib-module-shadowing/).\n\nIn preview mode the default value is `false` rather than `true`.",
|
||||||
"type": [
|
"type": [
|
||||||
"boolean",
|
"boolean",
|
||||||
"null"
|
"null"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue