Honor banned top level imports by TID253 in PLC0415. #15628
Honor banned top level imports by TID253 in PLC0415. #15628MichaReiser merged 5 commits intoastral-sh:mainfrom
Conversation
|
| code | total | + violation | - violation | + fix | - fix |
|---|---|---|---|---|---|
| PLC0415 | 66 | 0 | 66 | 0 | 0 |
|
The ecosystem changes look off. Would you mind taking a look? E.g. I don't think |
yes, sure, I will. I wanted to run these checks locally yesterday, but it was getting late, so I haven’t had time to figure that out. First time making smth. with a lint. Thanks for the heads up |
extend test cases to cover all variations
|
@MichaReiser I believe this is now all fixed. Spot checked half of Airflow changes, all numpy/pandas that are indeed banned by TID253 here and checked one case in bokeh, PIL is also banned here Let me know if this looks good! |
MichaReiser
left a comment
There was a problem hiding this comment.
Thanks. This looks good from a functionality but we should avoid collecting the names when calling the checker to avoid unnecessary overhead. I suggest moving the logic into import_outside_top_level and extract the names from stmt.
* main: Add `check` command (#15692) [red-knot] Use itertools to clean up `SymbolState::merge` (#15702) [red-knot] Add `--ignore`, `--warn`, and `--error` CLI arguments (#15689) Use `uv init --lib` in tutorial (#15718) [red-knot] Use `Unknown | T_inferred` for undeclared public symbols (#15674) [`ruff`] Parenthesize fix when argument spans multiple lines for `unnecessary-round` (`RUF057`) (#15703) [red-knot] Rename `TestDbBuilder::typeshed` to `.custom_typeshed` (#15712) Honor banned top level imports by TID253 in PLC0415. (#15628) Apply `AIR302`-context check only in `@task` function (#15711) [`airflow`] Update `AIR302` to check for deprecated context keys (#15144) Remove test rules from JSON schema (#15627) Add two missing commits to changelog (#15701) Fix grep for version number in docker build (#15699) Bump version to 0.9.3 (#15698) Preserve raw string prefix and escapes (#15694) [`flake8-pytest-style`] Rewrite references to `.exception` (`PT027`) (#15680)
Summary
Fixes #12803
I didn't dare to extract the shared module matching logic from tidy-imports into some helper module, so there is some questionable cross-use between lints.
Test Plan
Added new snapshot test