Class: Rubocop::Cop::WhileUntilModifier

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

Instance Attribute Summary

Attributes inherited from Cop

#correlations, #debug, #disabled_lines, #offences

Instance Method Summary collapse

Methods included from FavorModifier

#check, #length

Methods inherited from Cop

#add_offence, cop_name, #has_report?, inherited, #initialize, #name

Constructor Details

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

Instance Method Details

#error_messageObject



73
74
75
# File 'lib/rubocop/cop/favor_modifier.rb', line 73

def error_message
  'Favor modifier while/until usage when you have a single-line body.'
end

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



77
78
79
# File 'lib/rubocop/cop/favor_modifier.rb', line 77

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