Skip to content

implicit-cwd (FURB177)

Added in 0.5.0 · Related issues · View source

Derived from the refurb linter.

Fix is sometimes available.

What it does

Checks for current-directory lookups using Path().resolve().

Why is this bad?

When looking up the current directory, prefer Path.cwd() over Path().resolve(), as Path.cwd() is more explicit in its intent.

Example

from pathlib import Path

cwd = Path().resolve()

Use instead:

from pathlib import Path

cwd = Path.cwd()

References