Sha256: 230cfb4dc5033a42b6f56961e27f672fde7ca12709c4dabb937a1a87191643d8
Contents?: true
Size: 892 Bytes
Versions: 2
Compression:
Stored size: 892 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 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, :expression) 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rubocop-0.49.1 | lib/rubocop/cop/layout/space_after_not.rb |
rubocop-0.49.0 | lib/rubocop/cop/layout/space_after_not.rb |