Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[flake8-use-pathlib] Add autofix for PTH211#20009

Merged
dylwil3 merged 11 commits into
astral-sh:mainfrom
chirizxc:pth211-autofix
Aug 22, 2025
Merged

[flake8-use-pathlib] Add autofix for PTH211#20009
dylwil3 merged 11 commits into
astral-sh:mainfrom
chirizxc:pth211-autofix

Conversation

@chirizxc

@chirizxc chirizxc commented Aug 20, 2025

Copy link
Copy Markdown
Contributor

Summary

Part of #2331

Test Plan

cargo nextest run flake8_use_pathlib

@github-actions

github-actions Bot commented Aug 20, 2025

Copy link
Copy Markdown
Contributor

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@dylwil3 dylwil3 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for this! Couple small comments.

Comment thread crates/ruff_linter/src/rules/flake8_use_pathlib/rules/os_symlink.rs
Comment thread crates/ruff_linter/src/rules/flake8_use_pathlib/rules/os_symlink.rs
@chirizxc

Copy link
Copy Markdown
Contributor Author

done

@dylwil3 dylwil3 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thank you!

@dylwil3 dylwil3 added fixes Related to suggested fixes for violations preview Related to preview mode features labels Aug 22, 2025
@dylwil3

dylwil3 commented Aug 22, 2025

Copy link
Copy Markdown
Collaborator

Adding a minor edit - it looks like you can pass an arbitrary type to target_is_directory without CPython throwing an error. (I think it evaluates the truthiness of the value). I've skipped the fix in these cases instead of just throwing out the value, since otherwise I think we may change program behavior. If CI passes I'll merge

@chirizxc

chirizxc commented Aug 22, 2025

Copy link
Copy Markdown
Contributor Author

For some reason, a lot of Safe fixes are missing from the snapshots

@dylwil3 dylwil3 merged commit 0be3e1f into astral-sh:main Aug 22, 2025
35 checks passed
@chirizxc

Copy link
Copy Markdown
Contributor Author
изображение i mean this

@dylwil3

dylwil3 commented Aug 22, 2025

Copy link
Copy Markdown
Collaborator

For some reason, a lot of Safe fixes are missing from the snapshots

I swear I checked the ecosystem results and everything... maybe they were not updated even when they said they were? Oy. Thank you for the quick followup PR!

dylwil3 pushed a commit that referenced this pull request Aug 22, 2025
@chirizxc chirizxc deleted the pth211-autofix branch August 22, 2025 18:37
ntBre pushed a commit that referenced this pull request Aug 26, 2025
…20099)

<!--
Thank you for contributing to Ruff/ty! To help us out with reviewing,
please consider the following:

- Does this pull request include a summary of the change? (See below.)
- Does this pull request include a descriptive title? (Please prefix
with `[ty]` for ty pull
  requests.)
- Does this pull request include references to any relevant issues?
-->

## Summary
Part of #20009 (i forgot to delete it in this PR)
<!-- What's the purpose of the change? What does it do, and why? -->

## Test Plan

<!-- How was it tested? -->
second-ed pushed a commit to second-ed/ruff that referenced this pull request Sep 9, 2025
second-ed pushed a commit to second-ed/ruff that referenced this pull request Sep 9, 2025
second-ed pushed a commit to second-ed/ruff that referenced this pull request Sep 9, 2025
…stral-sh#20099)

<!--
Thank you for contributing to Ruff/ty! To help us out with reviewing,
please consider the following:

- Does this pull request include a summary of the change? (See below.)
- Does this pull request include a descriptive title? (Please prefix
with `[ty]` for ty pull
  requests.)
- Does this pull request include references to any relevant issues?
-->

## Summary
Part of astral-sh#20009 (i forgot to delete it in this PR)
<!-- What's the purpose of the change? What does it do, and why? -->

## Test Plan

<!-- How was it tested? -->
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.

2 participants