Sha256: a86a866d0913682b73df7f7620ba18e0485a03e70a7b4aa58c4f1c584d7ce6d5
Contents?: true
Size: 906 Bytes
Versions: 11
Compression:
Stored size: 906 Bytes
Contents
# frozen_string_literal: true module RuboCop module Cop module Layout # This cop checks for space after `!`. # # @example # # bad # ! something # # # good # !something class SpaceAfterNot < Cop include RangeHelp MSG = 'Do not leave space between `!` and its argument.'.freeze def on_send(node) return unless node.keyword_bang? && whitespace_after_operator?(node) add_offense(node) end def whitespace_after_operator?(node) node.receiver.loc.column - node.loc.column > 1 end def autocorrect(node) lambda do |corrector| corrector.remove( range_between(node.loc.selector.end_pos, node.receiver.source_range.begin_pos) ) end end end end end end
Version data entries
11 entries across 11 versions & 2 rubygems