Class: Steep::Drivers::Validate
- Inherits:
-
Object
- Object
- Steep::Drivers::Validate
- Includes:
- Utils::DriverHelper
- Defined in:
- lib/steep/drivers/validate.rb
Instance Attribute Summary collapse
-
#stderr ⇒ Object
readonly
Returns the value of attribute stderr.
-
#stdout ⇒ Object
readonly
Returns the value of attribute stdout.
Attributes included from Utils::DriverHelper
Instance Method Summary collapse
-
#initialize(stdout:, stderr:) ⇒ Validate
constructor
A new instance of Validate.
- #run ⇒ Object
Methods included from Utils::DriverHelper
Constructor Details
#initialize(stdout:, stderr:) ⇒ Validate
Returns a new instance of Validate.
9 10 11 12 |
# File 'lib/steep/drivers/validate.rb', line 9 def initialize(stdout:, stderr:) @stdout = stdout @stderr = stderr end |
Instance Attribute Details
#stderr ⇒ Object (readonly)
Returns the value of attribute stderr.
5 6 7 |
# File 'lib/steep/drivers/validate.rb', line 5 def stderr @stderr end |
#stdout ⇒ Object (readonly)
Returns the value of attribute stdout.
4 5 6 |
# File 'lib/steep/drivers/validate.rb', line 4 def stdout @stdout end |
Instance Method Details
#run ⇒ Object
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 |