Class: RuboCop::Cop::Rails::SafeNavigationWithBlank
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Rails::SafeNavigationWithBlank
- Extended by:
- AutoCorrector
- Defined in:
- lib/rubocop/cop/rails/safe_navigation_with_blank.rb
Overview
Checks to make sure safe navigation isn't used with `blank?` in a conditional.
Constant Summary collapse
- MSG =
'Avoid calling `blank?` with the safe navigation operator ' \ 'in conditionals.'
Instance Method Summary collapse
Instance Method Details
#on_if(node) ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/rubocop/cop/rails/safe_navigation_with_blank.rb', line 42 def on_if(node) return unless (node) add_offense(node) do |corrector| corrector.replace((node).location.dot, '.') end end |