-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
bugSomething isn't workingSomething isn't workinghelp wantedContributions especially welcomeContributions especially welcomeruleImplementing or modifying a lint ruleImplementing or modifying a lint rule
Description
Summary
os-stat (PTH116) should be suppressed when dir_fd is set to a non-None value because the suggested Path methods don’t support file descriptors. This is a follow-up to #17693.
$ cat >pth116.py <<'# EOF'
import os
os.stat("x", dir_fd=3)
# EOF
$ ruff --isolated check --select PTH116 pth116.py
pth116.py:2:1: PTH116 `os.stat()` should be replaced by `Path.stat()`, `Path.owner()`, or `Path.group()`
|
1 | import os
2 | os.stat("x", dir_fd=3)
| ^^^^^^^ PTH116
|
Found 1 error.Version
ruff 0.11.8 (75effb8 2025-05-01)
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinghelp wantedContributions especially welcomeContributions especially welcomeruleImplementing or modifying a lint ruleImplementing or modifying a lint rule