66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
# File 'lib/pdk/validate.rb', line 66
def self.invoke_validators_by_name(context, names, parallel = false, options = {})
instances = names.select { |name| validator_names.include?(name) }
.map { |name| validator_hash[name].new(context, options) }
.select { |instance| instance.valid_in_context? }
.each { |instance| instance.prepare_invoke! }
report = PDK::Report.new
return [0, report] if instances.empty?
require 'pdk/cli/exec_group'
exec_group = PDK::CLI::ExecGroup.create(
_('Validating module using %{num_of_threads} threads' % { num_of_threads: instances.count }),
{ parallel: parallel },
options,
)
instances.each do |validator|
exec_group.register do
validator.invoke(report)
end
end
[exec_group.exit_code, report]
end
|