[flake8-use-pathlib] Add an autofix for extension access (PTH122) by jinchuntan · Pull Request #29453 · astral-sh/ruff · GitHub
Skip to content

[flake8-use-pathlib] Add an autofix for extension access (PTH122) - #29453

Closed
jinchuntan wants to merge 1 commit into
astral-sh:mainfrom
jinchuntan:feat/pth122-suffix-fix
Closed

jinchuntan wants to merge 1 commit into
astral-sh:mainfrom
jinchuntan:feat/pth122-suffix-fix

Conversation

@jinchuntan

Copy link
Copy Markdown

Adds a preview autofix for PTH122 that replaces os.path.splitext(path)[1] and [-1] with Path(path).suffix. The fix is unsafe because path normalization can change the result. Includes regression coverage for aliases and unsupported cases. All 34 pathlib tests and 3 regression suites pass along with Clippy and repo hooks. Related to #2331.

@astral-sh-bot
astral-sh-bot Bot requested a review from ntBre October 18, 2026 01:40
@ntBre ntBre added the bot:ai-policy-close Auto-close a PR due to a violation of the org AI policy label Oct 19, 2026
@astral-sh-bot

astral-sh-bot Bot commented Oct 19, 2026

Copy link
Copy Markdown

@astral-sh-bot astral-sh-bot Bot closed this Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:ai-policy-close Auto-close a PR due to a violation of the org AI policy

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants