class RuboCop::Cop::Style::DoubleNegation

!something.nil?
# good
!!something
# bad
@example
should be avoided.
to a boolean value. As this is both cryptic and usually redundant it
This cop checks for uses of double negation (!!) to convert something

def not_node?(node)

def not_node?(node)
  _receiver, method_name, *args = *node
  # ! does not take any arguments
  args.empty? && method_name == :! &&
    node.loc.selector.is?('!')
end

def on_send(node)

def on_send(node)
  return unless not_node?(node)
  receiver, _method_name, *_args = *node
  add_offense(node, :selector) if not_node?(receiver)
end