Skip to content

Conversation

fennr
Copy link
Contributor

@fennr fennr commented May 27, 2025

Summary

/closes #18250

Test Plan

Add snapshot

@MichaReiser MichaReiser added the rule Implementing or modifying a lint rule label May 28, 2025
Copy link
Member

@MichaReiser MichaReiser left a comment

Choose a reason for hiding this comment

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

Thanks. I think there's an error in the example and we have to account for symlink calls with an fd argument

@fennr fennr requested a review from MichaReiser May 28, 2025 08:23
@MichaReiser MichaReiser force-pushed the feat/pathlib_symlink branch from d436bc5 to 2bd163f Compare May 28, 2025 09:22
Copy link
Contributor

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

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

apache/airflow (+6 -0 violations, +0 -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:845:25: PTH211 `os.symlink` should be replaced by `Path.symlink_to`
+ airflow-core/src/airflow/dag_processing/manager.py:851: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: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:167:9: PTH211 `os.symlink` should be replaced by `Path.symlink_to`

zulip/zulip (+3 -0 violations, +0 -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/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`

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

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

+ astropy/config/paths.py:214:17: PTH211 `os.symlink` should be replaced by `Path.symlink_to`

Changes by rule (1 rules affected)

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

@MichaReiser MichaReiser added the preview Related to preview mode features label May 28, 2025
@MichaReiser MichaReiser merged commit b60ba75 into astral-sh:main May 28, 2025
34 checks passed
dcreager added a commit that referenced this pull request May 28, 2025
* main:
  [ty] Support ephemeral uv virtual environments (#18335)
  Add a `ViolationMetadata::rule` method (#18234)
  Return `DiagnosticGuard` from `Checker::report_diagnostic` (#18232)
  [flake8_use_pathlib]: Replace os.symlink with Path.symlink_to (PTH211) (#18337)
  [ty] Support cancellation and retry in the server (#18273)
  [ty] Synthetic function-like callables (#18242)
  [ty] Support publishing diagnostics in the server (#18309)
  Add Autofix for ISC003 (#18256)
  [`pyupgrade`]: new rule UP050 (`useless-class-metaclass-type`) (#18334)
  [pycodestyle] Make `E712` suggestion not assume a context (#18328)
carljm added a commit to MatthewMckee4/ruff that referenced this pull request May 28, 2025
* main: (246 commits)
  [ty] Simplify signature types, use them in `CallableType` (astral-sh#18344)
  [ty] Support ephemeral uv virtual environments (astral-sh#18335)
  Add a `ViolationMetadata::rule` method (astral-sh#18234)
  Return `DiagnosticGuard` from `Checker::report_diagnostic` (astral-sh#18232)
  [flake8_use_pathlib]: Replace os.symlink with Path.symlink_to (PTH211) (astral-sh#18337)
  [ty] Support cancellation and retry in the server (astral-sh#18273)
  [ty] Synthetic function-like callables (astral-sh#18242)
  [ty] Support publishing diagnostics in the server (astral-sh#18309)
  Add Autofix for ISC003 (astral-sh#18256)
  [`pyupgrade`]: new rule UP050 (`useless-class-metaclass-type`) (astral-sh#18334)
  [pycodestyle] Make `E712` suggestion not assume a context (astral-sh#18328)
  put similar dunder-call tests next to each other (astral-sh#18343)
  [ty] Derive `PartialOrd, Ord` for `KnownInstanceType` (astral-sh#18340)
  [ty] Simplify `Type::try_bool()` (astral-sh#18342)
  [ty] Simplify `Type::normalized` slightly (astral-sh#18339)
  [ty] Move arviz off the list of selected primer projects (astral-sh#18336)
  [ty] Add --config-file CLI arg (astral-sh#18083)
  [ty] Tell the user why we inferred a certain Python version when reporting version-specific syntax errors (astral-sh#18295)
  [ty] Implement implicit inheritance from `Generic[]` for PEP-695 generic classes (astral-sh#18283)
  [ty] Add hint if async context manager is used in non-async with statement (astral-sh#18299)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
preview Related to preview mode features rule Implementing or modifying a lint rule
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a PTH rule to replace os.symlink with Path.symlink_to
2 participants