Class: RuboCop::Cop::Airbnb::SimpleUnless

Inherits:
Base
  • Object
show all
Defined in:
lib/rubocop/cop/airbnb/simple_unless.rb

Overview

Cop to tackle prevent unless statements with multiple conditions github.com/airbnb/ruby#unless-with-multiple-conditions

Constant Summary collapse

MSG =
'Unless usage is okay when there is only one conditional'.freeze

Instance Method Summary collapse

Instance Method Details

#on_if(node) ⇒ Object



11
12
13
14
15
# File 'lib/rubocop/cop/airbnb/simple_unless.rb', line 11

def on_if(node)
  return unless node.unless?

  add_offense(node) if multiple_conditionals?(node)
end