module Rubocop::Cop::SpaceInside

def check_unwanted_space(tokens, ix)

def check_unwanted_space(tokens, ix)
  paren = get_paren
  prev, t, nxt = tokens.values_at(ix - 1, ix, ix + 1)
  offence_detected = case t.type
                     when paren.left
                       nxt.type == :on_sp
                     when paren.right
                       if prev.type == :on_sp
                         prev_ns = previous_non_space(tokens, ix)
                         prev_ns &&
                           prev_ns.pos.lineno == tokens[ix].pos.lineno &&
                           # Avoid double reporting
                           prev_ns.type != paren.left
                       end
                     end
  if offence_detected
    add_offence(:convention, t.pos.lineno,
                "Space inside #{paren.kind} detected.")
  end
end