This cop checks for space after `!`.
@example
# bad ! something # good !something
# File lib/rubocop/cop/style/space_after_not.rb, line 26 def autocorrect(node) @corrections << lambda do |corrector| receiver, _method_name, *_args = *node space_range = Parser::Source::Range.new(node.loc.selector.source_buffer, node.loc.selector.end_pos, receiver.loc.expression.begin_pos) corrector.remove(space_range) end end
# File lib/rubocop/cop/style/space_after_not.rb, line 16 def on_send(node) _receiver, method_name, *_args = *node return unless method_name == :! return unless node.loc.expression.source =~ /^!\s+\w+/ # TODO: Improve source range to highlight the redundant whitespace. add_offense(node, :selector) end
Generated with the Darkfish Rdoc Generator 2.