Skip to content

Document link between import-outside-top-level (PLC0415) and lint.flake8-tidy-imports.banned-module-level-imports #18733

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Avasam
Copy link
Contributor

@Avasam Avasam commented Jun 17, 2025

@Avasam Avasam force-pushed the document-link-between-import-outside-top-level-PLC0415-and-lint_flake8-tidy-imports_banned-module-level-imports branch from 34f0033 to d194c49 Compare June 17, 2025 19:17
Comment on lines +47 to +53
/// ## Options
/// - `lint.flake8-tidy-imports.banned-module-level-imports`
///
/// ## See also
/// This rule will ignore import statements configured in
/// [`lint.flake8-tidy-imports.banned-module-level-imports`][banned-module-level-imports]
/// for the rule [`banned-module-level-imports`][TID253].
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wasn't sure whether to put this directly above ## Example, in ## See also or merge it into ## Options.

Suggested change
/// ## Options
/// - `lint.flake8-tidy-imports.banned-module-level-imports`
///
/// ## See also
/// This rule will ignore import statements configured in
/// [`lint.flake8-tidy-imports.banned-module-level-imports`][banned-module-level-imports]
/// for the rule [`banned-module-level-imports`][TID253].
/// ## Options
/// - This rule will ignore import statements configured in
/// [`lint.flake8-tidy-imports.banned-module-level-imports`][banned-module-level-imports]
/// for the rule [`banned-module-level-imports`][TID253].

Copy link
Contributor Author

@Avasam Avasam Jun 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, I didn't validate, but is this true all the time or only if banned-module-level-imports (TID253) is enabled ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like having a separate section, but I'd probably put ## See also before ## Options.

Oh, I didn't notice this when looking at the rule initially, but this is only true if TID253 is enabled. Good catch! Maybe that means we can just put the whole explanation in See also and not have separate Options since they only apply conditionally. I like your current See also section in that case, possibly with a slight alteration to the last line:

/// if the rule [`banned-module-level-imports`][TID253] is enabled.

Comment on lines +1999 to +2000
/// block, or some other nested context). This affects both `banned-module-level-imports`
/// and `import-outside-top-level` rules.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't make those links because they appear in the json schema.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may need the same caveat about "if TID253 is enabled" here too.

@Avasam Avasam changed the title Document link between import-outside-top-level-PLC0415 and lint_flake8-tidy-imports_banned-module-level-imports Document link between import-outside-top-level (PLC0415) and lint.flake8-tidy-imports.banned-module-level-imports Jun 17, 2025
Copy link
Contributor

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@ntBre ntBre self-requested a review June 17, 2025 22:44
@ntBre ntBre added the documentation Improvements or additions to documentation label Jun 17, 2025
Copy link
Contributor

@ntBre ntBre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! This looks great. We might just need to clarify that TID253 has to be enabled. Good idea to check that!

Comment on lines +47 to +53
/// ## Options
/// - `lint.flake8-tidy-imports.banned-module-level-imports`
///
/// ## See also
/// This rule will ignore import statements configured in
/// [`lint.flake8-tidy-imports.banned-module-level-imports`][banned-module-level-imports]
/// for the rule [`banned-module-level-imports`][TID253].
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like having a separate section, but I'd probably put ## See also before ## Options.

Oh, I didn't notice this when looking at the rule initially, but this is only true if TID253 is enabled. Good catch! Maybe that means we can just put the whole explanation in See also and not have separate Options since they only apply conditionally. I like your current See also section in that case, possibly with a slight alteration to the last line:

/// if the rule [`banned-module-level-imports`][TID253] is enabled.

Comment on lines +1999 to +2000
/// block, or some other nested context). This affects both `banned-module-level-imports`
/// and `import-outside-top-level` rules.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may need the same caveat about "if TID253 is enabled" here too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants