class Dependabot::Uv::UpdateChecker::RequirementsUpdater

def widen_requirement_range(req_string)

rubocop:disable Metrics/PerceivedComplexity
def widen_requirement_range(req_string)
  requirement_strings = req_string.split(",").map(&:strip)
  if requirement_strings.any? { |r| r.match?(/(^=|^\d)[^*]*$/) }
    # If there is an equality operator, just update that.
    # (i.e., assume it's being used deliberately)
    find_and_update_equality_match(requirement_strings)
  elsif requirement_strings.any? { |r| r.start_with?("~", "^") } ||
        requirement_strings.any? { |r| r.include?("*") }
    # If a compatibility operator is being used, widen its
    # range to include the new version
    v_req = requirement_strings
            .find { |r| r.start_with?("~", "^") || r.include?("*") }
    convert_to_range(v_req, latest_resolvable_version)
  else
    # Otherwise we have a range, and need to update the upper bound
    update_requirements_range(requirement_strings)
  end
end