Sha256: 154ea6b08a4259c528bdfff750e95a53897435c06c6883293cc731d3479fbc66

Contents?: true

Size: 1.01 KB

Versions: 4

Compression:

Stored size: 1.01 KB

Contents

module Steep
  module Drivers
    class Validate
      attr_reader :signature_dirs
      attr_reader :stdout
      attr_reader :stderr
      attr_accessor :verbose

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

        self.verbose = false
      end

      include Utils::EachSignature

      def run
        Steep.logger.level = Logger::DEBUG if verbose

        env = AST::Signature::Env.new

        each_signature(signature_dirs, verbose) do |signature|
          env.add signature
        end

        builder = Interface::Builder.new(signatures: env)
        check = Subtyping::Check.new(builder: builder)

        validator = Utils::Validator.new(stdout: stdout, stderr: stderr, verbose: verbose)

        validator.run(env: env, builder: builder, check: check) do |sig|
          stderr.puts "Validating #{sig.name} (#{sig.location.name}:#{sig.location.start_line})..." if verbose
        end ? 0 : 1
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
steep-0.9.0 lib/steep/drivers/validate.rb
steep-0.8.2 lib/steep/drivers/validate.rb
steep-0.8.1 lib/steep/drivers/validate.rb
steep-0.8.0 lib/steep/drivers/validate.rb