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
18 19 20 |
# File 'lib/rubocop/cop/mixin/space_inside.rb', line 18 def autocorrect(range) ->(corrector) { corrector.remove(range) } end |
#investigate(processed_source) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/rubocop/cop/mixin/space_inside.rb', line 11 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 |