settings-direct-instantiation (BTCONF003)¶
Added in 0.10.0 · Preview · Off by default (warning)
Family: config · Standard: CES-76 · Languages: python
This rule is unstable and in preview. It runs only with preview = true, and only when it is selected.
Directive¶
A settings class is built in one place, the cached get_settings(). A call such as
Settings() or AppSettings(...) anywhere else is reported. A warning by default.
Why¶
Every call re-reads the environment, and a test cannot override the settings of a module that built its own.
Do¶
Don't¶
Suppression¶
A comment on the line of the call silences it.