settings-module (BTCONF001)¶
Added in 0.8.0 · Stable · Enabled by default (warning)
Family: config · Standard: CES-76 · Languages: python
Directive¶
Read the environment in one place: the settings module. os.getenv(...) and os.environ
anywhere else are reported. A warning by default.
Why¶
Scattered os.getenv calls leave the configuration with no type and no documentation. Its
defaults are spread across files, nothing validates it, and nothing lists the variables the
application reads.
Exceptions¶
The rule skips the files where the environment is read on purpose:
settings.pyand every file undersettings/.conftest.pyand every file undertests/.
Do¶
Don't¶
Suppression¶
A comment on the line of the os.getenv(...) or os.environ read silences it.