Module: RuboCop::Cop::SpaceInside
- Includes:
- SurroundingSpace
- Defined in:
- lib/rubocop/cop/mixin/space_inside.rb
Overview
Common functionality for checking for spaces inside various kinds of brackets.
Defined Under Namespace
Classes: Brackets
Constant Summary collapse
- MSG =
'Space inside %s detected.'.freeze
Instance Method Summary collapse
Methods included from SurroundingSpace
#index_of_first_token, #index_of_last_token, #space_between?, #token_table
Instance Method Details
#autocorrect(range) ⇒ Object
19 20 21 |
# File 'lib/rubocop/cop/mixin/space_inside.rb', line 19 def autocorrect(range) ->(corrector) { corrector.remove(range) } end |
#investigate(processed_source) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/rubocop/cop/mixin/space_inside.rb', line 12 def investigate(processed_source) @processed_source = processed_source each_extraneous_space(processed_source.tokens) do |kind, range| add_offense(range, range, format(MSG, kind)) end end |