Skip to content
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

Incorrect Import Removal Causes Undefined Name Error in Ruff Auto-Fix #15583

Closed
brupelo opened this issue Jan 19, 2025 · 0 comments · Fixed by #15585
Closed

Incorrect Import Removal Causes Undefined Name Error in Ruff Auto-Fix #15583

brupelo opened this issue Jan 19, 2025 · 0 comments · Fixed by #15585
Assignees
Labels
bug Something isn't working fixes Related to suggested fixes for violations

Comments

@brupelo
Copy link

brupelo commented Jan 19, 2025

Testing last origin/main at f1af2a3

File: imports_invalid_removal\bad_boy.py

from PySide6.QtWidgets import (
    QSlider,
)

from PySide6.QtCore import (
    Qt,
    Qt,
)


class TimeSliderControl(QSlider):
    def __init__(self, parent=None):
        super().__init__(Qt.Horizontal, parent)
        self.setMinimum(0)
        self.setMaximum(100)
        self.setValue(0)
ruff check --fix bad_boy.py --output-format=concise && ruff format bad_boy.py
D:\sources\github\astral-sh\bugs-ruff\imports_invalid_removal\bad_boy.py:8:26: F821 Undefined name `Qt`
Found 3 errors (2 fixed, 1 remaining).

File: imports_invalid_removal\good_boy.py

from PySide6.QtWidgets import (
    QSlider,
)

from PySide6.QtCore import (
    Qt,
)


class TimeSliderControl(QSlider):
    def __init__(self, parent=None):
        super().__init__(Qt.Horizontal, parent)
        self.setMinimum(0)
        self.setMaximum(100)
        self.setValue(0)
>> debug: cmd: ruff check --fix D:\sources\github\astral-sh\bugs-ruff\imports_invalid_removal\good_boy.py --output-format=concise && ruff format D:\sources\github\astral-sh\bugs-ruff\imports_invalid_removal\good_boy.py
>> debug: working_dir: D:\sources\github\astral-sh\bugs-ruff\imports_invalid_removal
Found 1 error (1 fixed, 0 remaining).
1 file reformatted

Leftover from related issue at #15182

@charliermarsh charliermarsh self-assigned this Jan 19, 2025
@charliermarsh charliermarsh added bug Something isn't working fixes Related to suggested fixes for violations labels Jan 19, 2025
charliermarsh added a commit that referenced this issue Jan 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixes Related to suggested fixes for violations
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants