class RuboCop::Cop::Minitest::SkipWithoutReason


skip if condition?
# good
skip(“Reason why the test was skipped”)
# good
end
skip
else
skip
if condition?
# bad
skip(”)
skip
# bad
@example
Checks for skipped tests missing the skipping reason.

def blank_argument?(node)

def blank_argument?(node)
  message = node.first_argument
  message.nil? || (message.str_type? && message.value == '')
end

def conditional_parent(node)

def conditional_parent(node)
  return unless (parent = node.parent)
  if parent.if_type? || parent.case_type?
    parent
  elsif parent.when_type?
    parent.parent
  end
end

def on_send(node)

def on_send(node)
  return if node.receiver || !blank_argument?(node)
  conditional_node = conditional_parent(node)
  return if conditional_node && !only_skip_branches?(conditional_node)
  return if node.parent&.resbody_type?
  add_offense(node)
end

def only_skip_branches?(node)

def only_skip_branches?(node)
  branches = node.branches.compact
  branches.size > 1 && branches.all? { |branch| branch.send_type? && branch.method?(:skip) }
end