Method: Steep::CLI#process_check

Defined in:
lib/steep/cli.rb

#process_checkObject



184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
# File 'lib/steep/cli.rb', line 184

def process_check
  with_signature_options do |signature_options|
    verbose = false
    dump_all_types = false
    fallback_any_is_error = false
    strict = false

    OptionParser.new do |opts|
      handle_dir_options opts, signature_options
      opts.on("--verbose") { verbose = true }
      opts.on("--dump-all-types") { dump_all_types = true }
      opts.on("--strict") { strict = true }
      opts.on("--fallback-any-is-error") { fallback_any_is_error = true }
    end.parse!(argv)

    source_paths = argv.map {|path| Pathname(path) }
    if source_paths.empty?
      source_paths << Pathname(".")
    end

    Drivers::Check.new(source_paths: source_paths, signature_dirs: signature_options.paths, stdout: stdout, stderr: stderr).tap do |check|
      check.verbose = verbose
      check.dump_all_types = dump_all_types
      check.fallback_any_is_error = fallback_any_is_error || strict
      check.allow_missing_definitions = false if strict
    end.run
  end
end