Skip to content

Comments

[flake8-pyi] Add autofix for unused-private-type-var (PYI018)#15999

Merged
AlexWaygood merged 4 commits intoastral-sh:mainfrom
ayushbaweja:fix-pyi018-unused-private-type-var
Feb 6, 2025
Merged

[flake8-pyi] Add autofix for unused-private-type-var (PYI018)#15999
AlexWaygood merged 4 commits intoastral-sh:mainfrom
ayushbaweja:fix-pyi018-unused-private-type-var

Conversation

@ayushbaweja
Copy link
Contributor

Resolves #15940

Summary

This pull request adds an autofix for the flake8-pyi rule PYI018 (Unused private type variable). Currently, Ruff detects and reports unused private type variables, but it doesn't offer a way to automatically remove them. This change addresses this by providing an autofix that deletes the unused type variable definition.

Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this looks great!

@AlexWaygood AlexWaygood added the fixes Related to suggested fixes for violations label Feb 6, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2025

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! I'll push a few small fixups and then land 👍

@AlexWaygood AlexWaygood added the preview Related to preview mode features label Feb 6, 2025
@AlexWaygood AlexWaygood merged commit ba2f0e9 into astral-sh:main Feb 6, 2025
21 checks passed
@ayushbaweja ayushbaweja deleted the fix-pyi018-unused-private-type-var branch February 6, 2025 18:10
MichaReiser added a commit that referenced this pull request Mar 13, 2025
…#16682)

## Summary

This PR stabilizes the fix for `PYI018` introduced in
#15999 (first released with Ruff
0.9.5 early February)

There are no known issues with the fix or open PRs.
MichaReiser added a commit that referenced this pull request Mar 13, 2025
…#16682)

## Summary

This PR stabilizes the fix for `PYI018` introduced in
#15999 (first released with Ruff
0.9.5 early February)

There are no known issues with the fix or open PRs.
MichaReiser added a commit that referenced this pull request Mar 13, 2025
…#16682)

## Summary

This PR stabilizes the fix for `PYI018` introduced in
#15999 (first released with Ruff
0.9.5 early February)

There are no known issues with the fix or open PRs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fixes Related to suggested fixes for violations preview Related to preview mode features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[flake8-pyi] Add autofix for unused-private-type-var (PYI018)

2 participants