class Steep::CLI

def process_check

def process_check
  Drivers::Check.new(stdout: stdout, stderr: stderr).tap do |command|
    OptionParser.new do |opts|
      opts.banner = <<BANNER
e: steep check [options] [paths]
ription:
Type check the program.
If paths are specified, it type checks and validates the files at the given path.
Otherwise, it type checks and validates all files in the project or the groups if specified.
ons:
ER
      handle_steepfile_option(opts, command)
      opts.on("--with-expectations[=PATH]", "Type check with expectations saved in PATH (or steep_expectations.yml)") do |path|
        command.with_expectations_path = Pathname(path || "steep_expectations.yml")
      end
      opts.on("--save-expectations[=PATH]", "Save expectations with current type check result to PATH (or steep_expectations.yml)") do |path|
        command.save_expectations_path = Pathname(path || "steep_expectations.yml")
      end
      opts.on("--severity-level=LEVEL", /^error|warning|information|hint$/, "Specify the minimum diagnostic severity to be recognized as an error (defaults: warning): error, warning, information, or hint") do |level|
        command.severity_level = level.to_sym
      end
      opts.on("--group=GROUP", "Specify target/group name to type check") do |arg|
        # @type var arg: String
        target, group = arg.split(".")
        target or raise
        case group
        when "*"
          command.active_group_names << [target.to_sym, true]
        when nil
          command.active_group_names << [target.to_sym, nil]
        else
          command.active_group_names << [target.to_sym, group.to_sym]
        end
      end
      opts.on("--[no-]type-check", "Type check Ruby code") do |v|
        command.type_check_code = v ? true : false
      end
      opts.on("--validate=OPTION", ["skip", "group", "project", "library"], "Validation levels of signatures (default: group, options: skip,group,project,library)") do |level|
        case level
        when "skip"
          command.validate_group_signatures = false
          command.validate_project_signatures = false
          command.validate_library_signatures = false
        when "group"
          command.validate_group_signatures = true
          command.validate_project_signatures = false
          command.validate_library_signatures = false
        when "project"
          command.validate_group_signatures = true
          command.validate_project_signatures = true
          command.validate_library_signatures = false
        when "library"
          command.validate_group_signatures = true
          command.validate_project_signatures = true
          command.validate_library_signatures = true
        end
      end
      opts.on("--format=FORMATTER", ["code", "github"], "Output formatters (default: code, options: code,github)") do |formatter|
        command.formatter = formatter
      end
      handle_jobs_option command.jobs_option, opts
      handle_logging_options opts
    end.parse!(argv)
    setup_jobs_for_ci(command.jobs_option)
    command.command_line_patterns.push(*argv)
  end.run
end