Do not raise invalid-envvar-default (PLW1508) when wrapped with `int` like in example
Author: GideonBearCreated Jul 21, 2026Updated Sep 27, 2026
Labelsdocumentation
Summary
invalid-envvar-default (PLW1508)
import os
int(os.getenv("FOO", 1))It is unclear to me why this is an anti-pattern. There is no confusing behavior here. I propose to:
- Add an exception for an
os.getenvcall immediately wrapped byintwhere the default argument is anintliteral - Change the lint example to for example
os.getenv("FOO", 1)(withoutintcall)
Source: astral-sh/ruff