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
#on_new_investigation ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/rubocop/cop/mixin/space_before_punctuation.rb', line 12 def on_new_investigation each_missing_space(processed_source.sorted_tokens) do |token, pos_before| add_offense(pos_before, message: format(MSG, token: kind(token))) do |corrector| PunctuationCorrector.remove_space(corrector, pos_before) end end end |