Module: RuboCop::Cop::SpaceBeforePunctuation
- Includes:
- RangeHelp
- 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.'
Instance Method Summary collapse
Instance Method Details
#investigate(processed_source) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/rubocop/cop/mixin/space_before_punctuation.rb', line 12 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 |