Class: Rubocop::Cop::FavorUntilOverNegatedWhile

Inherits:
Cop
  • Object
show all
Includes:
FavorOtherKeywordOverNegation
Defined in:
lib/rubocop/cop/favor_unless_over_negated_if.rb

Instance Attribute Summary

Attributes inherited from Cop

#correlations, #offences

Instance Method Summary collapse

Methods inherited from Cop

#add_offence, #has_report?, inherited, #initialize

Constructor Details

This class inherits a constructor from Rubocop::Cop::Cop

Instance Method Details

#error_messageObject



38
39
40
# File 'lib/rubocop/cop/favor_unless_over_negated_if.rb', line 38

def error_message
  'Favor until over while for negative conditions.'
end

#inspect(file, source, tokens, sexp) ⇒ Object



42
43
44
# File 'lib/rubocop/cop/favor_unless_over_negated_if.rb', line 42

def inspect(file, source, tokens, sexp)
  [:while, :while_mod].each { |grammar_part| check(grammar_part, sexp) }
end