Skip to content

[flake8-use-pathlib] Fix PTH211 autofix#20049

Merged
dylwil3 merged 1 commit intoastral-sh:mainfrom
chirizxc:pth211
Aug 22, 2025
Merged

[flake8-use-pathlib] Fix PTH211 autofix#20049
dylwil3 merged 1 commit intoastral-sh:mainfrom
chirizxc:pth211

Conversation

@chirizxc
Copy link
Contributor

@chirizxc chirizxc commented Aug 22, 2025

Summary

Part of #20009

Test Plan

cargo nextest run flake8_use_pathlib

@chirizxc
Copy link
Contributor Author

@dylwil3 this commit caused the misbehavior

@chirizxc
Copy link
Contributor Author

I think we can check if target_is_directory is actually a boolean before, as in this PR

Copy link
Collaborator

@dylwil3 dylwil3 left a comment

Choose a reason for hiding this comment

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

Wow good catch - I guess I got confused about the preview vs non-preview snapshots or something... my bad!

@github-actions
Copy link
Contributor

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

ℹ️ ecosystem check detected linter changes. (+0 -0 violations, +24 -0 fixes in 3 projects; 52 projects unchanged)

apache/airflow (+0 -0 violations, +16 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --no-fix --output-format concise --preview --select ALL

+ airflow-core/src/airflow/dag_processing/manager.py:858:25: PTH211 [*] `os.symlink` should be replaced by `Path.symlink_to`
- airflow-core/src/airflow/dag_processing/manager.py:858:25: PTH211 `os.symlink` should be replaced by `Path.symlink_to`
+ airflow-core/src/airflow/dag_processing/manager.py:864:21: PTH211 [*] `os.symlink` should be replaced by `Path.symlink_to`
- airflow-core/src/airflow/dag_processing/manager.py:864:21: PTH211 `os.symlink` should be replaced by `Path.symlink_to`
+ airflow-core/src/airflow/utils/log/file_processor_handler.py:127:25: PTH211 [*] `os.symlink` should be replaced by `Path.symlink_to`
- airflow-core/src/airflow/utils/log/file_processor_handler.py:127:25: PTH211 `os.symlink` should be replaced by `Path.symlink_to`
+ airflow-core/src/airflow/utils/log/file_processor_handler.py:133:21: PTH211 [*] `os.symlink` should be replaced by `Path.symlink_to`
- airflow-core/src/airflow/utils/log/file_processor_handler.py:133:21: PTH211 `os.symlink` should be replaced by `Path.symlink_to`
+ airflow-core/tests/unit/utils/test_file.py:107:9: PTH211 [*] `os.symlink` should be replaced by `Path.symlink_to`
- airflow-core/tests/unit/utils/test_file.py:107:9: PTH211 `os.symlink` should be replaced by `Path.symlink_to`
+ airflow-core/tests/unit/utils/test_file.py:165:9: PTH211 [*] `os.symlink` should be replaced by `Path.symlink_to`
- airflow-core/tests/unit/utils/test_file.py:165:9: PTH211 `os.symlink` should be replaced by `Path.symlink_to`
+ scripts/ci/prek/check_shared_distributions_usage.py:204:17: PTH211 [*] `os.symlink` should be replaced by `Path.symlink_to`
- scripts/ci/prek/check_shared_distributions_usage.py:204:17: PTH211 `os.symlink` should be replaced by `Path.symlink_to`
+ scripts/ci/prek/check_shared_distributions_usage.py:224:17: PTH211 [*] `os.symlink` should be replaced by `Path.symlink_to`
- scripts/ci/prek/check_shared_distributions_usage.py:224:17: PTH211 `os.symlink` should be replaced by `Path.symlink_to`

zulip/zulip (+0 -0 violations, +6 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --no-fix --output-format concise --preview --select ALL

+ scripts/lib/puppet_cache.py:48:5: PTH211 [*] `os.symlink` should be replaced by `Path.symlink_to`
- scripts/lib/puppet_cache.py:48:5: PTH211 `os.symlink` should be replaced by `Path.symlink_to`
+ scripts/lib/zulip_tools.py:55:13: PTH211 [*] `os.symlink` should be replaced by `Path.symlink_to`
- scripts/lib/zulip_tools.py:55:13: PTH211 `os.symlink` should be replaced by `Path.symlink_to`
+ tools/lib/provision.py:59:5: PTH211 [*] `os.symlink` should be replaced by `Path.symlink_to`
- tools/lib/provision.py:59:5: PTH211 `os.symlink` should be replaced by `Path.symlink_to`

astropy/astropy (+0 -0 violations, +2 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --no-fix --output-format concise --preview

+ astropy/config/paths.py:210:17: PTH211 [*] `os.symlink` should be replaced by `Path.symlink_to`
- astropy/config/paths.py:210:17: PTH211 `os.symlink` should be replaced by `Path.symlink_to`

Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
PTH211 24 0 0 24 0

Copy link
Collaborator

@dylwil3 dylwil3 left a comment

Choose a reason for hiding this comment

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

Alright, thank you this looks good!

@dylwil3 dylwil3 added fixes Related to suggested fixes for violations preview Related to preview mode features labels Aug 22, 2025
@dylwil3 dylwil3 changed the title [flake8-use-pathlib] Fix PTH211 autofix [flake8-use-pathlib] Fix PTH211 autofix Aug 22, 2025
@dylwil3 dylwil3 merged commit 886c4e4 into astral-sh:main Aug 22, 2025
37 checks passed
@chirizxc chirizxc deleted the pth211 branch August 22, 2025 18:36
second-ed pushed a commit to second-ed/ruff that referenced this pull request Sep 9, 2025
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