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