Skip to content

Commit d194c49

Browse files
committed
Document link between import-outside-top-level-PLC0415 and lint_flake8-tidy-imports_banned-module-level-imports
1 parent a2cd6df commit d194c49

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

crates/ruff_linter/src/rules/pylint/rules/import_outside_top_level.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,16 @@ use crate::{
4444
/// print(python.python_version())
4545
/// ```
4646
///
47+
/// ## Options
48+
/// - `lint.flake8-tidy-imports.banned-module-level-imports`
49+
///
50+
/// ## See also
51+
/// This rule will ignore import statements configured in
52+
/// [`lint.flake8-tidy-imports.banned-module-level-imports`][banned-module-level-imports]
53+
/// for the rule [`banned-module-level-imports`][TID253].
54+
///
55+
/// [banned-module-level-imports]: https://docs.astral.sh/ruff/settings/#lint_flake8-tidy-imports_banned-module-level-imports
56+
/// [TID253]: https://docs.astral.sh/ruff/rules/banned-module-level-imports/
4757
/// [PEP 8]: https://peps.python.org/pep-0008/#imports
4858
#[derive(ViolationMetadata)]
4959
pub(crate) struct ImportOutsideTopLevel;

crates/ruff_workspace/src/options.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1996,7 +1996,8 @@ pub struct Flake8TidyImportsOptions {
19961996

19971997
/// List of specific modules that may not be imported at module level, and should instead be
19981998
/// imported lazily (e.g., within a function definition, or an `if TYPE_CHECKING:`
1999-
/// block, or some other nested context).
1999+
/// block, or some other nested context). This affects both `banned-module-level-imports`
2000+
/// and `import-outside-top-level` rules.
20002001
#[option(
20012002
default = r#"[]"#,
20022003
value_type = r#"list[str]"#,

ruff.schema.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)