class RuboCop::Cop::Ezcater::RailsEnv
Use the `Rails.configuration.x` namespace for configuration backed by environment variables, rather than inspecting `Rails.env` directly.
Centralizing application configuration helps avoid scattering it throughout the codebase, and avoids coarse environment grouping under a single env var. See ezcater.atlassian.net/wiki/x/ZIChNg.
@example
# good enforce_foo! if Rails.configuration.x.foo_enforced # bad enforce_foo! if Rails.env.production? # bad enforce_foo! if ENV["RAILS_ENV"] == "production"
Constants
- MSG
Public Instance Methods
on_send(node)
click to toggle source
# File lib/rubocop/cop/ezcater/rails_env.rb, line 34 def on_send(node) rails_env(node) do add_offense(node, location: :expression, message: MSG) end end