Class: RuboCop::Cop::Rails::UnknownEnv
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Rails::UnknownEnv
- Defined in:
- lib/rubocop/cop/rails/unknown_env.rb
Overview
Checks that environments called with ‘Rails.env` predicates exist. By default the cop allows three environments which Rails ships with: `development`, `test`, and `production`. More can be added to the `Environments` config parameter.
Constant Summary collapse
- MSG =
'Unknown environment `%<name>s`.'
- MSG_SIMILAR =
'Unknown environment `%<name>s`. Did you mean `%<similar>s`?'
Instance Method Summary collapse
Instance Method Details
#on_send(node) ⇒ Object
41 42 43 44 45 46 47 48 49 50 |
# File 'lib/rubocop/cop/rails/unknown_env.rb', line 41 def on_send(node) unknown_environment_predicate?(node) do |name| add_offense(node.loc.selector, message: (name)) end unknown_environment_equal?(node) do |str_node| name = str_node.value add_offense(str_node, message: (name)) end end |