Sha256: 921e8b0f39e749924b58a3fb8d1ec6700521ef9e68c4edee3143cf01f4de673e

Contents?: true

Size: 1.1 KB

Versions: 32

Compression:

Stored size: 1.1 KB

Contents

module Steep
  module Drivers
    class Validate
      attr_reader :stdout
      attr_reader :stderr

      include Utils::DriverHelper

      def initialize(stdout:, stderr:)
        @stdout = stdout
        @stderr = stderr
      end

      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
    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
steep-0.39.0 lib/steep/drivers/validate.rb
steep-0.38.0 lib/steep/drivers/validate.rb
steep-0.37.0 lib/steep/drivers/validate.rb
steep-0.36.0 lib/steep/drivers/validate.rb
steep-0.35.0 lib/steep/drivers/validate.rb
steep-0.34.0 lib/steep/drivers/validate.rb
steep-0.33.0 lib/steep/drivers/validate.rb
steep-0.32.0 lib/steep/drivers/validate.rb
steep-0.31.1 lib/steep/drivers/validate.rb
steep-0.31.0 lib/steep/drivers/validate.rb
steep-0.30.0 lib/steep/drivers/validate.rb
steep-0.29.0 lib/steep/drivers/validate.rb
steep-0.28.0 lib/steep/drivers/validate.rb
steep-0.27.0 lib/steep/drivers/validate.rb
steep-0.25.0 lib/steep/drivers/validate.rb
steep-0.24.0 lib/steep/drivers/validate.rb
steep-0.23.0 lib/steep/drivers/validate.rb
steep-0.22.0 lib/steep/drivers/validate.rb
steep-0.21.0 lib/steep/drivers/validate.rb
steep-0.20.0 lib/steep/drivers/validate.rb