Class: RuboCop::Cop::Rails::EnvironmentComparison
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Rails::EnvironmentComparison
- Extended by:
- AutoCorrector
- Defined in:
- lib/rubocop/cop/rails/environment_comparison.rb
Overview
Checks that ‘Rails.env` is compared using `.production?`-like methods instead of equality against a string or symbol.
Constant Summary collapse
- MSG =
'Favor `%<prefer>s` over `%<source>s`.'- SYM_MSG =
'Do not compare `Rails.env` with a symbol, it will always evaluate to `false`.'- RESTRICT_ON_SEND =
i[== !=].freeze
Instance Method Summary collapse
Instance Method Details
#on_send(node) ⇒ Object
74 75 76 77 |
# File 'lib/rubocop/cop/rails/environment_comparison.rb', line 74 def on_send(node) check_env_comparison_with_rails_env(node) check_sym_env_comparison_with_rails_env(node) end |