def initialize(args:, options:)
loader = options.loader()
@env = Environment.from_loader(loader).resolve_type_names
@builder = DefinitionBuilder.new(env: @env)
@validator = Validator.new(env: @env)
limit = nil
OptionParser.new do |opts|
opts.banner = <<EOU
Usage: rbs validate
Validate RBS files. It ensures the type names in RBS files are present and the type applications have correct arity.
Examples:
$ rbs validate
EOU
opts.on("--silent", "This option has been deprecated and does nothing.") do
RBS.print_warning { "`--silent` option is deprecated because it's silent by default. You can use --log-level option of rbs command to display more information." }
end
opts.on("--[no-]exit-error-on-syntax-error", "exit(1) if syntax error is detected") {|bool|
RBS.print_warning { "`--exit-error-on-syntax-error` option is deprecated because it's validated during parsing.." }
}
opts.on("--fail-fast", "Exit immediately as soon as a validation error is found.") do |arg|
limit = 1
end
end.parse!(args)
@errors = Errors.new(limit: limit)
end