Sha256: fff7344865e75d61ed70b3d61874cf7b834b759a9e45be5b4006fd09cb68afab
Contents?: true
Size: 850 Bytes
Versions: 3
Compression:
Stored size: 850 Bytes
Contents
# encoding: utf-8 module Rubocop module Cop module Style # Checks for colon (:) not follwed by some kind of space. class SpaceAfterColon < Cop include IfNode MSG = 'Space missing after colon.' def on_pair(node) oper = node.loc.operator if oper.is?(':') && oper.source_buffer.source[oper.end_pos] =~ /\S/ add_offence(oper, oper) end end def on_if(node) if ternary_op?(node) colon = node.loc.colon if colon.source_buffer.source[colon.end_pos] =~ /\S/ add_offence(colon, colon) end end end def autocorrect(range) @corrections << lambda do |corrector| corrector.insert_after(range, ' ') end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rubocop-0.18.1 | lib/rubocop/cop/style/space_after_colon.rb |
rubocop-0.18.0 | lib/rubocop/cop/style/space_after_colon.rb |
rubocop-0.17.0 | lib/rubocop/cop/style/space_after_colon.rb |