-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
base: main
Are you sure you want to change the base?
Conversation
…8-tidy-imports_banned-module-level-imports
34f0033
to
d194c49
Compare
/// ## 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]. |
There was a problem hiding this comment.
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
.
/// ## 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]. |
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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.
/// block, or some other nested context). This affects both `banned-module-level-imports` | ||
/// and `import-outside-top-level` rules. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
import-outside-top-level (PLC0415)
and lint.flake8-tidy-imports.banned-module-level-imports
|
There was a problem hiding this 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!
/// ## 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]. |
There was a problem hiding this comment.
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.
/// block, or some other nested context). This affects both `banned-module-level-imports` | ||
/// and `import-outside-top-level` rules. |
There was a problem hiding this comment.
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.
Summary
As mentioned in #18728 (comment) CC @ntBre
Test Plan
Run the docs locally as per https://github.com/astral-sh/ruff/blob/a2cd6df429a3e76880a48a5eb8816a86c36927ed/CONTRIBUTING.md#mkdocs