class RuboCop::Cop::Style::SpaceAfterMethodName
Checks for space between a method name and a left parenthesis in defs.
@example
# bad def func (x) ... end # good def func(x) ... end
Constants
- MSG
Public Instance Methods
autocorrect(pos_before_left_paren)
click to toggle source
# File lib/rubocop/cop/style/space_after_method_name.rb, line 32 def autocorrect(pos_before_left_paren) ->(corrector) { corrector.remove(pos_before_left_paren) } end
on_method_def(_node, _method_name, args, _body)
click to toggle source
# File lib/rubocop/cop/style/space_after_method_name.rb, line 21 def on_method_def(_node, _method_name, args, _body) return unless args.loc.begin && args.loc.begin.is?('(') expr = args.source_range pos_before_left_paren = Parser::Source::Range.new(expr.source_buffer, expr.begin_pos - 1, expr.begin_pos) return unless pos_before_left_paren.source =~ /\s/ add_offense(pos_before_left_paren, pos_before_left_paren) end