class RuboCop::Cop::Style::SpaceAfterNot
This cop checks for space after `!`.
@example
# bad ! something # good !something
Constants
- MSG
Public Instance Methods
autocorrect(node)
click to toggle source
# File lib/rubocop/cop/style/space_after_not.rb, line 26 def autocorrect(node) 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.source_range.begin_pos) corrector.remove(space_range) end end
on_send(node)
click to toggle source
# File lib/rubocop/cop/style/space_after_not.rb, line 17 def on_send(node) receiver, method_name, *_args = *node return unless method_name == :! return unless receiver.loc.column - node.loc.column > 1 add_offense(node, :expression) end