class RuboCop::Cop::Layout::SpaceAfterMethodName
Checks for space between a method name and a left parenthesis in defs.
@example
# bad def func (x) end def method= (y) end # good def func(x) end def method=(y) end
Constants
- MSG
Public Instance Methods
Source
# File lib/rubocop/cop/layout/space_after_method_name.rb, line 23 def on_def(node) args = node.arguments return unless args.parenthesized_call? expr = args.source_range pos_before_left_paren = range_between(expr.begin_pos - 1, expr.begin_pos) return unless pos_before_left_paren.source.start_with?(' ') add_offense(pos_before_left_paren) do |corrector| corrector.remove(pos_before_left_paren) end end
Also aliased as: on_defs