Base YAML config loader & Ameba runner

This commit is contained in:
Vitalii Elenhaupt 2017-11-13 23:20:22 +02:00
parent 80e2ab4f55
commit 822a69b81c
No known key found for this signature in database
GPG key ID: 7558EF3A4056C706
7 changed files with 158 additions and 32 deletions

View file

@ -1,7 +1,7 @@
require "../src/ameba"
require "benchmark"
private def get_sources(n)
private def get_files(n)
Dir["src/**/*.cr"].first(n)
end
@ -16,10 +16,11 @@ Benchmark.ips do |x|
30,
40,
].each do |n|
sources = get_sources(n)
formatter = Ameba::Formatter::BaseFormatter.new
config = Ameba::Config.load
config.formatter = Ameba::Formatter::BaseFormatter.new
config.files = get_files(n)
s = n == 1 ? "" : "s"
x.report("#{n} source#{s}") { Ameba.run sources, formatter }
x.report("#{n} source#{s}") { Ameba.run config }
end
end