Method: Steep::Drivers::Validate#run

Defined in:
lib/steep/drivers/validate.rb

#runObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/steep/drivers/validate.rb', line 14

def run
  project = load_config()

  loader = Project::FileLoader.new(project: project)
  loader.load_signatures()

  type_check(project)

  project.targets.each do |target|
    Steep.logger.tagged "target=#{target.name}" do
      case (status = target.status)
      when Project::Target::SignatureSyntaxErrorStatus
        printer = SignatureErrorPrinter.new(stdout: stdout, stderr: stderr)
        printer.print_syntax_errors(status.errors)
      when Project::Target::SignatureValidationErrorStatus
        printer = SignatureErrorPrinter.new(stdout: stdout, stderr: stderr)
        printer.print_semantic_errors(status.errors)
      end
    end
  end

  project.targets.all? {|target| target.status.is_a?(Project::Target::TypeCheckStatus) } ? 0 : 1
end