Sha256: c3ca8c569cadebc0578344e0fdfadffe8ca0ec37aee7812d6ced942c207a1f52
Contents?: true
Size: 970 Bytes
Versions: 1
Compression:
Stored size: 970 Bytes
Contents
# encoding: utf-8 module Rubocop module Cop module Lint # Checks for space between a method name and the first argument for # method calls without parentheses. # # @example # # something?x # something!x # class SpaceBeforeFirstArg < Cop MSG = 'Put space between the method name and the first argument.' def on_send(node) return if parentheses?(node) _receiver, method_name, *args = *node return if args.empty? return if operator?(method_name) # Setter calls with parentheses are parsed this way. The parentheses # belong to the argument, not the send node. return if args.first.type == :begin arg1 = args.first.loc.expression arg1_with_space = range_with_surrounding_space(arg1, :left) add_offense(nil, arg1) if arg1_with_space.source =~ /^\S/ end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rubocop-0.20.0 | lib/rubocop/cop/lint/space_before_first_arg.rb |