-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[
unconventional-import-alias
] Fix infinite loop between ICN001 and …
…I002 (`ICN001`) (#15480) ## Summary This fixes the infinite loop reported in #14389 by raising an error to the user about conflicting ICN001 (`unconventional-import-alias`) and I002 (`missing-required-import`) configuration options. ## Test Plan Added a CLI integration test reproducing the old behavior and then confirming the fix. Closes #14389 --------- Co-authored-by: Alex Waygood <[email protected]>
- Loading branch information
1 parent
ca3b210
commit e2da33a
Showing
4 changed files
with
93 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
crates/ruff/tests/snapshots/lint__flake8_import_convention_unused_aliased_import.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
source: crates/ruff/tests/lint.rs | ||
info: | ||
program: ruff | ||
args: | ||
- check | ||
- "--no-cache" | ||
- "--output-format" | ||
- concise | ||
- "--config" | ||
- "lint.isort.required-imports = [\"import pandas\"]" | ||
- "--select" | ||
- "I002,ICN001,F401" | ||
- "--stdin-filename" | ||
- test.py | ||
- "--unsafe-fixes" | ||
- "--fix" | ||
- "-" | ||
stdin: "1" | ||
snapshot_kind: text | ||
--- | ||
success: false | ||
exit_code: 2 | ||
----- stdout ----- | ||
|
||
----- stderr ----- | ||
ruff failed | ||
Cause: Required import specified in `lint.isort.required-imports` (I002) conflicts with the required import alias specified in either `lint.flake8-import-conventions.aliases` or `lint.flake8-import-conventions.extend-aliases` (ICN001): | ||
- `pandas` -> `pd` | ||
|
||
Help: Remove the required import or alias from your configuration. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters