Class: RuboCop::Cop::Ezcater::RailsEnv
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Ezcater::RailsEnv
- Defined in:
- lib/rubocop/cop/ezcater/rails_env.rb
Overview
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 https://ezcater.atlassian.net/wiki/x/ZIChNg.
Constant Summary collapse
- MSG =
<<~END_MESSAGE.split("\n").join(" ") Use `Rails.configuration.x.<foo>` for env-backed configuration instead of inspecting `Rails.env`, so that configuration is more centralized and gives finer control. https://ezcater.atlassian.net/wiki/x/ZIChNg END_MESSAGE
Instance Method Summary collapse
Instance Method Details
#on_send(node) ⇒ Object
34 35 36 37 38 |
# File 'lib/rubocop/cop/ezcater/rails_env.rb', line 34 def on_send(node) rails_env(node) do add_offense(node.loc.expression, message: MSG) end end |