forked from kputnam/stupidedi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.simplecov
144 lines (131 loc) · 6.22 KB
/
.simplecov
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
require "base64"
require "simplecov-inline-html"
require "term/ansicolor"
SimpleCov.start do
coverage_dir "build/generated/coverage"
add_filter %r{/spec}
add_filter %r{/segment_defs}
add_filter %r{/element_defs}
add_filter %r{/transaction_sets/[0-9]+/[A-Z0-9-]+\.rb}
add_filter %r{/stupidedi/editor}
add_group "Refinements", "lib/ruby"
add_group "Config", "lib/stupidedi/config"
add_group "Editor", "lib/stupidedi/editor"
add_group "Exceptions", "lib/stupidedi/exceptions"
add_group "Interchanges", "lib/stupidedi/interchanges"
add_group "Parser", "lib/stupidedi/parser"
add_group "Reader", "lib/stupidedi/reader"
add_group "Schema", "lib/stupidedi/schema"
add_group "TransactionSets", "lib/stupidedi/transaction_sets"
add_group "Values", "lib/stupidedi/values"
add_group "Versions", "lib/stupidedi/versions"
add_group "Writer", "lib/stupidedi/writer"
add_group "Zipper", "lib/stupidedi/zipper"
end
# Based on https://github.com/inossidabile/simplecov-summary/edit/master/lib/simplecov-summary.rb
class SimpleCov::Formatter::SummaryFormatter
def format(result)
puts "SimpleCov summary:"
name_width = (result.groups.keys + ["SUMMARY"]).map(&:length).max
count_width = result.groups.values.map(&:missed_lines).max.to_i.to_s.length
result.groups.sort.each do |name, files|
print_group(name, files, name_width, count_width)
end
print_group("SUMMARY", result.files, name_width, count_width)
end
def print_group(name, files, name_width, count_width)
pct = files.covered_percent
clr = case pct
when 90..100 then :green
when 80..90 then :yellow
else :red
end
puts Term::ANSIColor.send(clr,
(" % #{name_width}s: % 5s%% " +
"% #{count_width}s missed lines, " +
"% #{count_width + 2}s lines total") %
[name, pct.round(1), files.missed_lines.to_i, files.lines_of_code.to_i])
end
end
class SimpleCov::Formatter::CustomHtmlFormatter < SimpleCov::Formatter::InlineHTMLFormatter
def output_message(result)
end
# This image is missing from simplecov-inline-html
BORDER = <<-EOF.gsub(/\s/, '')
iVBORw0KGgoAAAANSUhEUgAAAAEAAABLCAIAAAA+tHrUAAAAUklEQVR4AcXH
sQ3AIAwFUfuDYADSMQkrMiVdqKGzLDnCRTaIUjzpjnvvodaKtRbM7KWqTkT4
PBF9Yu+NMQauUvx/Eu45Q0oJOWd3OsbomBmttQc0NiOlCz/4pgAAAABJRU5E
rkJggg==
EOF
# This image is missing from simplecov-inline-html
CONTROLS = <<-EOF.gsub(/\s/, '')
iVBORw0KGgoAAAANSUhEUgAAAOEAAABLCAMAAACx6hDAAAABj1BMVEVPT0/e
3t7b29vS0tK7urq5uLjq6uqZmZmSkpJaWlrU1NTj4+PFxcWvr6+goKBbW1u3
t7c9PT27u7vCwsKsrKxiYWGqqqq5ublbWlpeXV2Xl5fExMSbmpq6ubmNjY18
fHzy8vIrKystLS0sLCxNTU0uLi4wMDDNzc05OTns6+vl5eUvLy/q6ekqKipM
TExDQ0M4ODgyMjI2NjbZ2dk6OjrY2NjMzMxLS0vAwMBCQkLo5+dHR0cxMTFK
SkpBQUHv7u43NzdISEhFRUVRUVHx8fE7Ozs8PDwzMzNJSUnp6elGRkZQUFDr
6upeXl7t7e1gYGCoqKjv7+81NTWKiorn5uZERESCgoJdXV3p6OhOTk51dXVA
QEA+Pj6np6fu7e2+vr5cXFxSUlKJiYnOzs7s7OxTU1P29vbw8PB2dnZfX1/m
5eV4eHifn59qamqmpqbQ0NCOjo7Kysqzs7P4+PiDg4Otra3z8/M/P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HlkEmitEI0bV52yikOe7KnygYcK/0sK5wtrjpuMAAAAASUVORK5C
YII=
EOF
def file(path)
if path.end_with?("application.css")
css = super(path)
css.gsub!("url(colorbox/border.png)", "url(data:image/png;base64,#{BORDER})")
css.gsub!("url(colorbox/controls.png)", "url(data:image/png;base64,#{CONTROLS})")
# Fit more stuff without scroll bars, don't linewrap filenames
css << <<-EOF
body { padding:0 !important; }
.src_link { white-space:nowrap; }
.file_list { font-size: .8rem; }
.ui-icon { width:0px !important; height:0px !important; }
th { font-size:.7rem; overflow:hidden; white-space:normal !important; }
EOF
css
else
super(path)
end
end
end
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
SimpleCov::Formatter::SummaryFormatter,
SimpleCov::Formatter::CustomHtmlFormatter
])