class RuboCop::Cop::Ezcater::DirectEnvCheck
Use the `Rails.configuration.x` namespace for configuration backed by environment variables, rather than inspecting `ENV` directly.
Restricting environment variables references to be within application configuration makes it more obvious which env vars an application relies upon. See ezcater.atlassian.net/wiki/x/ZIChNg.
@example
# good enforce_foo! if Rails.configuration.x.foo_enforced # bad enforce_foo! if ENV["FOO_ENFORCED"] == "true"
Constants
- MSG
Public Instance Methods
on_const(node)
click to toggle source
# File lib/rubocop/cop/ezcater/direct_env_check.rb, line 32 def on_const(node) env_ref(node) do add_offense(node, location: :expression, message: MSG) end end