#27039·ruff

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)

python
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.getenv call immediately wrapped by int where the default argument is an int literal
  • Change the lint example to for example os.getenv("FOO", 1) (without int call)