simplecov-html 0.10.2 → 0.12.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +0 -1
  3. data/.rubocop.yml +42 -17
  4. data/.tool-versions +1 -0
  5. data/.travis.yml +15 -20
  6. data/CHANGELOG.md +72 -4
  7. data/Gemfile +10 -21
  8. data/Gemfile.lock +59 -0
  9. data/Guardfile +2 -0
  10. data/README.md +3 -3
  11. data/Rakefile +10 -5
  12. data/assets/javascripts/application.js +29 -34
  13. data/assets/javascripts/libraries/jquery-3.4.1.js +10598 -0
  14. data/assets/javascripts/plugins/jquery.colorbox.js +1101 -1086
  15. data/assets/javascripts/plugins/jquery.dataTables.js +15008 -0
  16. data/assets/javascripts/plugins/jquery.timeago.js +135 -44
  17. data/assets/stylesheets/plugins/datatables.css +462 -0
  18. data/assets/stylesheets/screen.css +316 -0
  19. data/lib/simplecov-html/version.rb +3 -1
  20. data/lib/simplecov-html.rb +28 -0
  21. data/public/DataTables-1.10.20/images/sort_asc.png +0 -0
  22. data/public/DataTables-1.10.20/images/sort_asc_disabled.png +0 -0
  23. data/public/DataTables-1.10.20/images/sort_both.png +0 -0
  24. data/public/DataTables-1.10.20/images/sort_desc.png +0 -0
  25. data/public/DataTables-1.10.20/images/sort_desc_disabled.png +0 -0
  26. data/public/application.css +1 -799
  27. data/public/application.js +7 -1707
  28. data/simplecov-html.gemspec +5 -4
  29. data/test/helper.rb +2 -0
  30. data/test/test_simple_cov-html.rb +3 -1
  31. data/views/covered_percent.erb +3 -0
  32. data/views/file_list.erb +63 -30
  33. data/views/layout.erb +8 -8
  34. data/views/source_file.erb +40 -9
  35. metadata +33 -40
  36. data/assets/javascripts/libraries/jquery-1.6.2.min.js +0 -18
  37. data/assets/javascripts/plugins/jquery.dataTables.min.js +0 -152
  38. data/assets/javascripts/plugins/jquery.url.js +0 -174
  39. data/assets/stylesheets/screen.css.sass +0 -220
  40. /data/public/{smoothness/images → images}/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  41. /data/public/{smoothness/images → images}/ui-bg_flat_75_ffffff_40x100.png +0 -0
  42. /data/public/{smoothness/images → images}/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  43. /data/public/{smoothness/images → images}/ui-bg_glass_65_ffffff_1x400.png +0 -0
  44. /data/public/{smoothness/images → images}/ui-bg_glass_75_dadada_1x400.png +0 -0
  45. /data/public/{smoothness/images → images}/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  46. /data/public/{smoothness/images → images}/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  47. /data/public/{smoothness/images → images}/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  48. /data/public/{smoothness/images → images}/ui-icons_222222_256x240.png +0 -0
  49. /data/public/{smoothness/images → images}/ui-icons_2e83ff_256x240.png +0 -0
  50. /data/public/{smoothness/images → images}/ui-icons_454545_256x240.png +0 -0
  51. /data/public/{smoothness/images → images}/ui-icons_888888_256x240.png +0 -0
  52. /data/public/{smoothness/images → images}/ui-icons_cd0a0a_256x240.png +0 -0
@@ -0,0 +1,316 @@
1
+ #loading {
2
+ position: fixed;
3
+ left: 40%;
4
+ top: 50%;
5
+ }
6
+
7
+ a {
8
+ color: #333;
9
+ text-decoration: none;
10
+ }
11
+ a:hover {
12
+ color: #000;
13
+ text-decoration: underline;
14
+ }
15
+
16
+ body {
17
+ font-family: "Lucida Grande", Helvetica, "Helvetica Neue", Arial, sans-serif;
18
+ padding: 12px;
19
+ background-color: #333;
20
+ }
21
+
22
+ h1, h2, h3, h4 {
23
+ color: #1C2324;
24
+ margin: 0;
25
+ padding: 0;
26
+ margin-bottom: 12px;
27
+ }
28
+
29
+ table {
30
+ width: 100%;
31
+ }
32
+
33
+ #content {
34
+ clear: left;
35
+ background-color: white;
36
+ border: 2px solid #ddd;
37
+ border-top: 8px solid #ddd;
38
+ padding: 18px;
39
+ -webkit-border-bottom-left-radius: 5px;
40
+ -webkit-border-bottom-right-radius: 5px;
41
+ -webkit-border-top-right-radius: 5px;
42
+ -moz-border-radius-bottomleft: 5px;
43
+ -moz-border-radius-bottomright: 5px;
44
+ -moz-border-radius-topright: 5px;
45
+ border-bottom-left-radius: 5px;
46
+ border-bottom-right-radius: 5px;
47
+ border-top-right-radius: 5px;
48
+ }
49
+
50
+ .dataTables_filter, .dataTables_info {
51
+ padding: 2px 6px;
52
+ }
53
+
54
+ abbr.timeago {
55
+ text-decoration: none;
56
+ border: none;
57
+ font-weight: bold;
58
+ }
59
+
60
+ .timestamp {
61
+ float: right;
62
+ color: #ddd;
63
+ }
64
+
65
+ .group_tabs {
66
+ list-style: none;
67
+ float: left;
68
+ margin: 0;
69
+ padding: 0;
70
+ }
71
+
72
+ .group_tabs li {
73
+ display: inline;
74
+ float: left;
75
+ }
76
+ .group_tabs li a {
77
+ font-family: Helvetica, Arial, sans-serif;
78
+ display: block;
79
+ float: left;
80
+ text-decoration: none;
81
+ padding: 4px 8px;
82
+ background-color: #aaa;
83
+ background: -webkit-gradient(linear, 0 0, 0 bottom, from(#dddddd), to(#aaaaaa));
84
+ background: -moz-linear-gradient(#dddddd, #aaaaaa);
85
+ background: linear-gradient(#dddddd, #aaaaaa);
86
+ text-shadow: #e5e5e5 1px 1px 0px;
87
+ border-bottom: none;
88
+ color: #333;
89
+ font-weight: bold;
90
+ margin-right: 8px;
91
+ border-top: 1px solid #efefef;
92
+ -webkit-border-top-left-radius: 2px;
93
+ -webkit-border-top-right-radius: 2px;
94
+ -moz-border-radius-topleft: 2px;
95
+ -moz-border-radius-topright: 2px;
96
+ border-top-left-radius: 2px;
97
+ border-top-right-radius: 2px;
98
+ }
99
+ .group_tabs li a:hover {
100
+ background-color: #ccc;
101
+ background: -webkit-gradient(linear, 0 0, 0 bottom, from(#eeeeee), to(#aaaaaa));
102
+ background: -moz-linear-gradient(#eeeeee, #aaaaaa);
103
+ background: linear-gradient(#eeeeee, #aaaaaa);
104
+ }
105
+ .group_tabs li a:active {
106
+ padding-top: 5px;
107
+ padding-bottom: 3px;
108
+ }
109
+ .group_tabs li.active a {
110
+ color: black;
111
+ text-shadow: #fff 1px 1px 0px;
112
+ background-color: #ddd;
113
+ background: -webkit-gradient(linear, 0 0, 0 bottom, from(white), to(#dddddd));
114
+ background: -moz-linear-gradient(white, #dddddd);
115
+ background: linear-gradient(white, #dddddd);
116
+ }
117
+
118
+ .file_list {
119
+ margin-bottom: 18px;
120
+ }
121
+
122
+ .file_list--responsive {
123
+ overflow-x: auto;
124
+ overflow-y: hidden;
125
+ }
126
+
127
+ a.src_link {
128
+ background: url("./magnify.png") no-repeat left 50%;
129
+ padding-left: 18px;
130
+ }
131
+
132
+ tr, td {
133
+ margin: 0;
134
+ padding: 0;
135
+ }
136
+
137
+ th {
138
+ white-space: nowrap;
139
+ }
140
+ th.ui-state-default {
141
+ cursor: pointer;
142
+ }
143
+ th span.ui-icon {
144
+ float: left;
145
+ }
146
+
147
+ td {
148
+ padding: 4px 8px;
149
+ }
150
+ td.strong {
151
+ font-weight: bold;
152
+ }
153
+
154
+ .cell--number {
155
+ text-align: right;
156
+ }
157
+
158
+ .source_table h3, .source_table h4 {
159
+ padding: 0;
160
+ margin: 0;
161
+ margin-bottom: 4px;
162
+ }
163
+
164
+ .source_table .header {
165
+ padding: 10px;
166
+ }
167
+
168
+ .source_table pre {
169
+ margin: 0;
170
+ padding: 0;
171
+ white-space: normal;
172
+ color: #000;
173
+ font-family: "Monaco", "Inconsolata", "Consolas", monospace;
174
+ }
175
+
176
+ .source_table code {
177
+ color: #000;
178
+ font-family: "Monaco", "Inconsolata", "Consolas", monospace;
179
+ }
180
+
181
+ .source_table pre {
182
+ background-color: #333;
183
+ }
184
+
185
+ .source_table pre ol {
186
+ margin: 0px;
187
+ padding: 0px;
188
+ margin-left: 45px;
189
+ font-size: 12px;
190
+ color: white;
191
+ }
192
+
193
+ .source_table pre li {
194
+ margin: 0px;
195
+ padding: 2px 6px;
196
+ border-left: 5px solid white;
197
+ }
198
+
199
+ .source_table pre li code {
200
+ white-space: pre;
201
+ white-space: pre-wrap;
202
+ }
203
+
204
+ .source_table pre .hits {
205
+ float: right;
206
+ margin-left: 10px;
207
+ padding: 2px 4px;
208
+ background-color: #444;
209
+ background: -webkit-gradient(linear, 0 0, 0 bottom, from(#222222), to(#666666));
210
+ background: -moz-linear-gradient(#222222, #666666);
211
+ background: linear-gradient(#222222, #666666);
212
+ color: white;
213
+ font-family: Helvetica, "Helvetica Neue", Arial, sans-serif;
214
+ font-size: 10px;
215
+ font-weight: bold;
216
+ text-align: center;
217
+ border-radius: 6px;
218
+ }
219
+
220
+ #footer {
221
+ color: #ddd;
222
+ font-size: 12px;
223
+ font-weight: bold;
224
+ margin-top: 12px;
225
+ text-align: right;
226
+ }
227
+
228
+ #footer a {
229
+ color: #eee;
230
+ text-decoration: underline;
231
+ }
232
+
233
+ #footer a:hover {
234
+ color: #fff;
235
+ text-decoration: none;
236
+ }
237
+
238
+ .green {
239
+ color: #090;
240
+ }
241
+
242
+ .red {
243
+ color: #900;
244
+ }
245
+
246
+ .yellow {
247
+ color: #da0;
248
+ }
249
+
250
+ .blue {
251
+ color: blue;
252
+ }
253
+
254
+ thead th {
255
+ background: white;
256
+ }
257
+
258
+ .source_table .covered {
259
+ border-color: #090;
260
+ }
261
+
262
+ .source_table .missed {
263
+ border-color: #900;
264
+ }
265
+
266
+ .source_table .never {
267
+ border-color: black;
268
+ }
269
+
270
+ .source_table .skipped {
271
+ border-color: #fc0;
272
+ }
273
+
274
+ .source_table .missed-branch {
275
+ border-color: #bf0000;
276
+ }
277
+
278
+ .source_table .covered:nth-child(odd) {
279
+ background-color: #CDF2CD;
280
+ }
281
+
282
+ .source_table .covered:nth-child(even) {
283
+ background-color: #DBF2DB;
284
+ }
285
+
286
+ .source_table .missed:nth-child(odd) {
287
+ background-color: #F7C0C0;
288
+ }
289
+
290
+ .source_table .missed:nth-child(even) {
291
+ background-color: #F7CFCF;
292
+ }
293
+
294
+ .source_table .never:nth-child(odd) {
295
+ background-color: #efefef;
296
+ }
297
+
298
+ .source_table .never:nth-child(even) {
299
+ background-color: #f4f4f4;
300
+ }
301
+
302
+ .source_table .skipped:nth-child(odd) {
303
+ background-color: #FBF0C0;
304
+ }
305
+
306
+ .source_table .skipped:nth-child(even) {
307
+ background-color: #FBFfCf;
308
+ }
309
+
310
+ .source_table .missed-branch:nth-child(odd) {
311
+ background-color: #cc8e8e;
312
+ }
313
+
314
+ .source_table .missed-branch:nth-child(even) {
315
+ background-color: #cc6e6e;
316
+ }
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module SimpleCov
2
4
  module Formatter
3
5
  class HTMLFormatter
4
- VERSION = "0.10.2".freeze
6
+ VERSION = "0.12.3"
5
7
  end
6
8
  end
7
9
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "erb"
2
4
  require "cgi"
3
5
  require "fileutils"
@@ -14,6 +16,10 @@ end
14
16
  module SimpleCov
15
17
  module Formatter
16
18
  class HTMLFormatter
19
+ def initialize
20
+ @branchable_result = SimpleCov.branch_coverage?
21
+ end
22
+
17
23
  def format(result)
18
24
  Dir[File.join(File.dirname(__FILE__), "../public/*")].each do |path|
19
25
  FileUtils.cp_r(path, asset_output_path)
@@ -29,6 +35,21 @@ module SimpleCov
29
35
  "Coverage report generated for #{result.command_name} to #{output_path}. #{result.covered_lines} / #{result.total_lines} LOC (#{result.covered_percent.round(2)}%) covered."
30
36
  end
31
37
 
38
+ def branchable_result?
39
+ # cached in initialize because we truly look it up a whole bunch of times
40
+ # and it's easier to cache here then in SimpleCov because there we might
41
+ # still enable/disable branch coverage criterion
42
+ @branchable_result
43
+ end
44
+
45
+ def line_status?(source_file, line)
46
+ if branchable_result? && source_file.line_with_missed_branch?(line.number)
47
+ "missed-branch"
48
+ else
49
+ line.status
50
+ end
51
+ end
52
+
32
53
  private
33
54
 
34
55
  # Returns the an erb instance for the template of given name
@@ -42,6 +63,7 @@ module SimpleCov
42
63
 
43
64
  def asset_output_path
44
65
  return @asset_output_path if defined?(@asset_output_path) && @asset_output_path
66
+
45
67
  @asset_output_path = File.join(output_path, "assets", SimpleCov::Formatter::HTMLFormatter::VERSION)
46
68
  FileUtils.mkdir_p(@asset_output_path)
47
69
  @asset_output_path
@@ -54,6 +76,8 @@ module SimpleCov
54
76
  # Returns the html for the given source_file
55
77
  def formatted_source_file(source_file)
56
78
  template("source_file").result(binding)
79
+ rescue Encoding::CompatibilityError => e
80
+ puts "Encoding problems with file #{source_file.filename}. Simplecov/ERB can't handle non ASCII characters in filenames. Error: #{e.message}."
57
81
  end
58
82
 
59
83
  # Returns a table containing the given source files
@@ -66,6 +90,10 @@ module SimpleCov
66
90
  template("file_list").result(binding)
67
91
  end
68
92
 
93
+ def covered_percent(percent)
94
+ template("covered_percent").result(binding)
95
+ end
96
+
69
97
  def coverage_css_class(covered_percent)
70
98
  if covered_percent > 90
71
99
  "green"