From e59f1ce197c3a63ef1d4989c9d46eafa5eaacb5c Mon Sep 17 00:00:00 2001 From: mgcaret Date: Mon, 6 Jan 2020 12:31:19 -0800 Subject: [PATCH] dictionary help indexing tool/coverage tooling --- utils/covrep.rb | 28 +++++++++++++++++++++++++++ utils/index.rb | 50 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100755 utils/covrep.rb create mode 100755 utils/index.rb diff --git a/utils/covrep.rb b/utils/covrep.rb new file mode 100755 index 0000000..b80f60d --- /dev/null +++ b/utils/covrep.rb @@ -0,0 +1,28 @@ +#!/usr/bin/ruby +require 'yaml' + +index_file = ARGV.shift || usage +File.readable?(index_file) || abort("#{index_file} not found!") + +index = YAML.load(File.read(index_file)) + +covered = [] +uncovered = [] + +index.each_pair do |name, props| + if props["tests"] && props["tests"] > 0 + covered << name + else + uncovered << name + end +end + +cov_percent = covered.count * 100 / (covered.count+uncovered.count) + +puts "Total words: #{covered.count+uncovered.count}" +puts "Covered words: #{covered.count}" +puts "Uncovered words: #{uncovered.count}" +uncovered.each_slice(5) do |sl| + puts "\t#{sl.join(' ')}" +end +puts "Coverage: #{cov_percent}%" diff --git a/utils/index.rb b/utils/index.rb new file mode 100755 index 0000000..5d86035 --- /dev/null +++ b/utils/index.rb @@ -0,0 +1,50 @@ +#!/usr/bin/ruby +require 'yaml' + +def usage + puts < help}) unless help.empty? + if flags + fl = flags.split('|') + output[name].merge!({"flags" => fl}) unless fl.empty? + end + output[name].merge!({"tests" => coverage[name]}) if coverage[name] + when /^\s*eword/ + help = [] + end +end + +puts output.to_yaml