-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
fixesRelated to suggested fixes for violationsRelated to suggested fixes for violationslinterRelated to the linterRelated to the linter
Description
Using path-constructor-current-directory (PTH201),
import pathlib
p = pathlib.Path(".") / "foo.txt"is auto-fixed to
import pathlib
p = pathlib.Path() / "foo.txt"by invoking ruff check --select PTH201 --fix --isolated /tmp/cwd.py using version 0.3.2.
The fix is correct. However, it would be more useful if it included the rest of the path (following the motivation of the rule, which is to reduce unnecessary explicit CWD specification). For example,
import pathlib
p = pathlib.Path("foo.txt")Search terms: PTH201, current working directory, pathlib
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
fixesRelated to suggested fixes for violationsRelated to suggested fixes for violationslinterRelated to the linterRelated to the linter