Module: RuboCop::Cop::SpaceBeforePunctuation

Included in:
Layout::SpaceBeforeComma, Layout::SpaceBeforeSemicolon
Defined in:
lib/rubocop/cop/mixin/space_before_punctuation.rb

Overview

Common functionality for cops checking for space before punctuation.

Constant Summary collapse

MSG =
'Space found before %<token>s.'.freeze

Instance Method Summary collapse

Instance Method Details

#investigate(processed_source) ⇒ Object



10
11
12
13
14
15
# File 'lib/rubocop/cop/mixin/space_before_punctuation.rb', line 10

def investigate(processed_source)
  each_missing_space(processed_source.tokens) do |token, pos_before|
    add_offense(pos_before, location: pos_before,
                            message: format(MSG, token: kind(token)))
  end
end