Class: RuboCop::Cop::Neeto::DirectEnvAccess
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Neeto::DirectEnvAccess
- Defined in:
- lib/rubocop/cop/neeto/direct_env_access.rb
Overview
Rails had ‘secrets.yml` which provided a single source of truth for all environment variables and their fallback values. Rails deprecated this in favor of encrypted credentials, so we created Secvault (github.com/neetozone/secvault) to maintain centralized configuration. Direct usage of `ENV` bypasses this system, making it harder to track what environment variables are being used and their defaults. This cop enforces that all environment variable access goes through `Secvault.secrets`.
Constant Summary collapse
- MSG =
"Do not use ENV directly. " \ "Use Secvault.secrets to maintain a single source of truth for configuration."
Instance Method Summary collapse
Instance Method Details
#on_const(node) ⇒ Object
40 41 42 43 44 |
# File 'lib/rubocop/cop/neeto/direct_env_access.rb', line 40 def on_const(node) return unless env_access?(node) add_offense(node) end |