-
Notifications
You must be signed in to change notification settings - Fork 170
Style Guide
Nick Irvine edited this page Nov 21, 2018
·
1 revision
Environment variables break encapsulation, badly. They're essential global variables that are never declared, only referenced.
And that doesn't just affect maintainability, readability, etc. Library consumers can't safely use your library in multithreaded code safely without locks around the environment.
Consider that consumers of the library include its own test suite: the tests have to do a bunch of env var setup/teardown to ensure they're not in unexpected (global) state. That's hard to get right.
Only code in a main
package should look at environment variables.