Open denisdefreyne opened 6 years ago
I'm using this patch in Checks.rb that does little more than adjust the loop to run each check in a separate thread, and a few formatting fixes. It works great.
class Nanoc::Checking::Runner
ClassID = Struct.new(:identifier)
def run_checks(classes)
Nanoc::Core::Compiler.new_for(@site).run_until_reps_built
puts "Starting checks…"
length = classes.map { |c| c.identifier.to_s.length }.max + 10
Parallel.map(classes) do |klass|
check = klass.create(@site)
check.run
puts format(" %-#{length}s%s", "Check #{klass.identifier}: ",check.issues.empty? ? 'ok'.green : 'error'.red)
check.issues.map!{Nanoc::Checking::Issue.new(_1.description,_1.subject,ClassID.new(klass.identifier))}
check.issues
end.reduce(:union)
end
end
(edited to use parallel gem, because some parts of the check runner are not thread safe. This required me to replace class in the Issue with a Struct to allow it to serialize)
@fjan said: