Sha256: 49014b95c75c147868bf9ec1bbc61ae386b29b06991eac2a478809bb967d0d50
Contents?: true
Size: 971 Bytes
Versions: 3
Compression:
Stored size: 971 Bytes
Contents
# encoding: utf-8 module Rubocop module Cop # Common functionality for checking for spaces inside various # kinds of parentheses. module SpaceInside include SurroundingSpace MSG = 'Space inside %s detected.' def investigate(processed_source) @processed_source = processed_source left, right, kind = specifics processed_source.tokens.each_cons(2) do |t1, t2| if t1.type == left || t2.type == right if t2.pos.line == t1.pos.line && space_between?(t1, t2) range = Parser::Source::Range.new(processed_source.buffer, t1.pos.end_pos, t2.pos.begin_pos) add_offence(range, range, format(MSG, kind)) end end end end def autocorrect(range) @corrections << ->(corrector) { corrector.remove(range) } end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rubocop-0.18.1 | lib/rubocop/cop/mixin/space_inside.rb |
rubocop-0.18.0 | lib/rubocop/cop/mixin/space_inside.rb |
rubocop-0.17.0 | lib/rubocop/cop/mixin/space_inside.rb |