-
Notifications
You must be signed in to change notification settings - Fork 1.5k
[pylint
] Ignore __init__.py files in (PLC0414)
#18400
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
Conversation
pylint
] Ignore __init__.py files in (PLC0414)
|
code | total | + violation | - violation | + fix | - fix |
---|---|---|---|---|---|
PLC0414 | 89 | 0 | 89 | 0 | 0 |
Linter (preview)
ℹ️ ecosystem check detected linter changes. (+0 -89 violations, +0 -0 fixes in 2 projects; 53 projects unchanged)
apache/airflow (+0 -5 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --no-fix --output-format concise --preview --select ALL
- airflow-core/src/airflow/decorators/__init__.py:20:5: PLC0414 Import alias does not rename original package - airflow-core/src/airflow/decorators/__init__.py:21:5: PLC0414 Import alias does not rename original package - airflow-core/src/airflow/decorators/__init__.py:22:5: PLC0414 Import alias does not rename original package - airflow-core/src/airflow/decorators/__init__.py:23:5: PLC0414 Import alias does not rename original package - airflow-core/src/airflow/decorators/__init__.py:24:5: PLC0414 Import alias does not rename original package
zulip/zulip (+0 -84 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --no-fix --output-format concise --preview --select ALL
- corporate/models/__init__.py:10:43: PLC0414 Import alias does not rename original package - corporate/models/__init__.py:11:43: PLC0414 Import alias does not rename original package - corporate/models/__init__.py:1:40: PLC0414 Import alias does not rename original package - corporate/models/__init__.py:2:39: PLC0414 Import alias does not rename original package - corporate/models/__init__.py:3:36: PLC0414 Import alias does not rename original package - corporate/models/__init__.py:4:36: PLC0414 Import alias does not rename original package - corporate/models/__init__.py:5:36: PLC0414 Import alias does not rename original package - corporate/models/__init__.py:6:43: PLC0414 Import alias does not rename original package - corporate/models/__init__.py:7:43: PLC0414 Import alias does not rename original package - corporate/models/__init__.py:8:43: PLC0414 Import alias does not rename original package - corporate/models/__init__.py:9:43: PLC0414 Import alias does not rename original package - zerver/models/__init__.py:10:34: PLC0414 Import alias does not rename original package - zerver/models/__init__.py:11:34: PLC0414 Import alias does not rename original package - zerver/models/__init__.py:12:34: PLC0414 Import alias does not rename original package - zerver/models/__init__.py:13:34: PLC0414 Import alias does not rename original package - zerver/models/__init__.py:14:34: PLC0414 Import alias does not rename original package - zerver/models/__init__.py:15:38: PLC0414 Import alias does not rename original package - zerver/models/__init__.py:16:36: PLC0414 Import alias does not rename original package - zerver/models/__init__.py:17:36: PLC0414 Import alias does not rename original package - zerver/models/__init__.py:18:36: PLC0414 Import alias does not rename original package - zerver/models/__init__.py:19:36: PLC0414 Import alias does not rename original package - zerver/models/__init__.py:1:27: PLC0414 Import alias does not rename original package - zerver/models/__init__.py:20:36: PLC0414 Import alias does not rename original package - zerver/models/__init__.py:21:36: PLC0414 Import alias does not rename original package - zerver/models/__init__.py:22:36: PLC0414 Import alias does not rename original package - zerver/models/__init__.py:23:36: PLC0414 Import alias does not rename original package - zerver/models/__init__.py:24:36: PLC0414 Import alias does not rename original package - zerver/models/__init__.py:25:36: PLC0414 Import alias does not rename original package - zerver/models/__init__.py:26:36: PLC0414 Import alias does not rename original package - zerver/models/__init__.py:27:36: PLC0414 Import alias does not rename original package - zerver/models/__init__.py:28:36: PLC0414 Import alias does not rename original package - zerver/models/__init__.py:29:36: PLC0414 Import alias does not rename original package - zerver/models/__init__.py:2:39: PLC0414 Import alias does not rename original package - zerver/models/__init__.py:30:36: PLC0414 Import alias does not rename original package - zerver/models/__init__.py:31:36: PLC0414 Import alias does not rename original package - zerver/models/__init__.py:32:36: PLC0414 Import alias does not rename original package - zerver/models/__init__.py:33:36: PLC0414 Import alias does not rename original package - zerver/models/__init__.py:34:36: PLC0414 Import alias does not rename original package - zerver/models/__init__.py:35:39: PLC0414 Import alias does not rename original package - zerver/models/__init__.py:36:44: PLC0414 Import alias does not rename original package - zerver/models/__init__.py:37:44: PLC0414 Import alias does not rename original package - zerver/models/__init__.py:38:40: PLC0414 Import alias does not rename original package - zerver/models/__init__.py:39:40: PLC0414 Import alias does not rename original package - zerver/models/__init__.py:3:32: PLC0414 Import alias does not rename original package - zerver/models/__init__.py:40:40: PLC0414 Import alias does not rename original package - zerver/models/__init__.py:41:40: PLC0414 Import alias does not rename original package - zerver/models/__init__.py:42:40: PLC0414 Import alias does not rename original package ... 37 additional changes omitted for project
Changes by rule (1 rules affected)
code | total | + violation | - violation | + fix | - fix |
---|---|---|---|---|---|
PLC0414 | 89 | 0 | 89 | 0 | 0 |
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.
Thanks! A couple nits
crates/ruff_linter/resources/test/fixtures/pylint/import_aliasing_2/__init__.py
Outdated
Show resolved
Hide resolved
crates/ruff_linter/src/rules/pylint/rules/useless_import_alias.rs
Outdated
Show resolved
Hide resolved
crates/ruff_linter/src/rules/pylint/rules/useless_import_alias.rs
Outdated
Show resolved
Hide resolved
Co-authored-by: Dylan <[email protected]>
Co-authored-by: Dylan <[email protected]>
72d9d86
to
9f9c0a0
Compare
On second thought I decided to gate this behind preview for now. (I think technically we don't have to since it reduces the number of lints, but it seems like a big enough change that I think it's a good idea). |
Thank you both! |
* main: (21 commits) [`flake8-logging`] Avoid false positive for `exc_info=True` outside `logger.exception` (`LOG014`) (#18737) [`flake8-pie`] Small docs fix to `PIE794` (#18829) [`pylint`] Ignore __init__.py files in (PLC0414) (#18400) Avoid generating diagnostics with per-file ignores (#18801) [`flake8-simplify`] Fix false negatives for shadowed bindings (`SIM910`, `SIM911`) (#18794) [ty] Fix panics when pulling types for `ClassVar` or `Final` parameterized with >1 argument (#18824) [`pylint`] add fix safety section (`PLR1714`) (#18415) [Perflint] Small docs improvement to `PERF401` (#18786) [`pylint`] Avoid flattening nested `min`/`max` when outer call has single argument (`PLW3301`) (#16885) [`ruff`] Added `cls.__dict__.get('__annotations__')` check (`RUF063`) (#18233) [ty] Use `HashTable` in `PlaceTable` (#18819) docs: Correct collections-named-tuple example to use PascalCase assignment (#16884) [ty] ecosystem-analyzer workflow (#18719) [ty] Add support for `@staticmethod`s (#18809) unnecessary_dict_kwargs doc - a note on type checking benefits (#18666) [`flake8-pytest-style`] Mark autofix for `PT001` and `PT023` as unsafe if there's comments in the decorator (#18792) [ty] Surface matched overload diagnostic directly (#18452) [ty] Report when a dataclass contains more than one `KW_ONLY` field (#18731) [`flake8-pie`] Add fix safety section to `PIE794` (#18802) [`pycodestyle`] Add fix safety section to `W291` and `W293` (#18800) ...
Summary
Ignore
__init__.py
files inuseless-import-alias
(PLC0414).See discussion in #18365 and #6294: we want to allow redundant aliases in
__init__.py
files, as they're almost always intentional explicit re-exports.Closes #18365
Closes #6294
Test Plan
I added a new snapshot test.