You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: type_check.rb
    path of file: ./repos/solargraph/lib/solargraph/diagnostics
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

module Solargraph
  module Diagnostics
    # TypeCheck reports methods with undefined return ty
    
      def diagnose source, api_map
        # return [] unless args.include?('always') || api_map.workspaced?(source.filename)
        severity = Diagnostics::Severities::ERROR
        level = (args.reverse.find { |a| ['normal', 'typed', 'strict', 'strong'].include?(a) }) || :normal
        checker = Solargraph::TypeChecker.new(source.filename, api_map: api_map, level: level.to_sym)
        checker.problems
          .sort { |a, b| a.location.range.start.line <=> b.location.range.start.line }
          .map do |problem|
            {
              range: extract_first_line(problem.location, source),
              severity: severity,
              source: 'Typecheck',
              message: problem.message
            }
          end
      end