Method: RuboCop::Cop::Style::SoleNestedConditional#on_if
- Defined in:
- lib/rubocop/cop/style/sole_nested_conditional.rb
#on_if(node) ⇒ Object
59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/rubocop/cop/style/sole_nested_conditional.rb', line 59 def on_if(node) return if node.ternary? || node.else? || node.elsif? if_branch = node.if_branch return if use_variable_assignment_in_condition?(node.condition, if_branch) return unless offending_branch?(node, if_branch) = format(MSG, conditional_type: node.keyword) add_offense(if_branch.loc.keyword, message: ) do |corrector| autocorrect(corrector, node, if_branch) end end |