openstudio_measure_tester 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +25 -0
- data/.rspec +3 -0
- data/.rubocop.yml +5 -0
- data/.travis.yml +15 -0
- data/Gemfile +8 -0
- data/LICENSE.md +13 -0
- data/README.md +61 -0
- data/Rakefile +11 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/dashboard/css/bootstrap-grid.css +2050 -0
- data/dashboard/css/bootstrap-grid.min.css +7 -0
- data/dashboard/css/bootstrap-reboot.css +330 -0
- data/dashboard/css/bootstrap.css +8975 -0
- data/dashboard/css/bootstrap.min.css +7 -0
- data/dashboard/css/dashboard.css +191 -0
- data/dashboard/index.html +558 -0
- data/dashboard/js/bootstrap.js +3894 -0
- data/dashboard/js/bootstrap.min.js +7 -0
- data/dashboard/js/jquery-3.3.1.min.js +2 -0
- data/lib/openstudio_measure_tester.rb +49 -0
- data/lib/openstudio_measure_tester/core_ext.rb +69 -0
- data/lib/openstudio_measure_tester/coverage.rb +174 -0
- data/lib/openstudio_measure_tester/dashboard.rb +33 -0
- data/lib/openstudio_measure_tester/minitest_result.rb +144 -0
- data/lib/openstudio_measure_tester/openstudio_style.rb +502 -0
- data/lib/openstudio_measure_tester/openstudio_testing_result.rb +167 -0
- data/lib/openstudio_measure_tester/rake_task.rb +258 -0
- data/lib/openstudio_measure_tester/rubocop_result.rb +213 -0
- data/lib/openstudio_measure_tester/templates/dashboard.html.erb +566 -0
- data/lib/openstudio_measure_tester/test_helper.rb +44 -0
- data/lib/openstudio_measure_tester/version.rb +31 -0
- data/openstudio_measure_tester.gemspec +35 -0
- metadata +230 -0
@@ -0,0 +1,566 @@
|
|
1
|
+
|
2
|
+
<!doctype html>
|
3
|
+
<html lang="en">
|
4
|
+
<head>
|
5
|
+
<meta charset="utf-8">
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
7
|
+
<meta name="description" content="">
|
8
|
+
<meta name="author" content="">
|
9
|
+
|
10
|
+
<title>Measure Testing Dashboard </title>
|
11
|
+
|
12
|
+
<!-- Bootstrap core CSS -->
|
13
|
+
<link href="css/bootstrap.min.css" rel="stylesheet">
|
14
|
+
|
15
|
+
<!-- Custom styles for this template -->
|
16
|
+
<link href="css/dashboard.css" rel="stylesheet">
|
17
|
+
</head>
|
18
|
+
<body>
|
19
|
+
<nav class="navbar navbar-dark sticky-top navbar-color flex-md-nowrap p-0">
|
20
|
+
<a class="navbar-brand col-sm-5 col-md-4 mr-0" href="#">OpenStudio Measure Testing Dashboard</a>
|
21
|
+
</nav>
|
22
|
+
|
23
|
+
<div class="container-fluid">
|
24
|
+
<div class="row">
|
25
|
+
<main role="main" class="col-md-12 ml-sm-auto col-lg-12 pt-3 px-4">
|
26
|
+
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pb-2 mb-3 border-bottom">
|
27
|
+
<h1 class="h2 accent">Overview</h1>
|
28
|
+
</div>
|
29
|
+
<div class="row">
|
30
|
+
<div class="col-sm">
|
31
|
+
<div class="card">
|
32
|
+
<div class="card-block">
|
33
|
+
<div class="card-body">
|
34
|
+
<h5 class="card-title">Tests</h5>
|
35
|
+
|
36
|
+
<% if @hash['minitest'] && @hash['minitest']['total_failures'] %>
|
37
|
+
<div class="row pt-3">
|
38
|
+
<% passed = @hash['minitest']['total_tests'] - (@hash['minitest']['total_failures'] + @hash['minitest']['total_errors'] + @hash['minitest']['total_skipped']) %>
|
39
|
+
<div class="col-sm-3 offset-sm-2 badge-med-height badge badge-success"><span class="med-text"><%= passed %></span></div>
|
40
|
+
<div class="col-sm-5 badge-med-height badge-text">Passed</div>
|
41
|
+
</div>
|
42
|
+
<div class="row pt-2">
|
43
|
+
<% if @hash['minitest']['total_failures'] > 0 %>
|
44
|
+
<div class="col-sm-3 offset-sm-2 badge-med-height badge badge-danger"><span class='med-text'><%= @hash['minitest']['total_failures'] %></span></div>
|
45
|
+
<% else %>
|
46
|
+
<div class="col-sm-3 offset-sm-2 badge-med-height badge badge-success"><span class='med-text'><%= @hash['minitest']['total_failures'] %></span></div>
|
47
|
+
<% end %>
|
48
|
+
<div class="col-sm-5 badge-med-height badge-text">Failures</div>
|
49
|
+
</div>
|
50
|
+
<div class="row pt-2">
|
51
|
+
<% if @hash['minitest']['total_errors'] > 0 %>
|
52
|
+
<div class="col-sm-3 offset-sm-2 badge-med-height badge badge-danger"><span class='med-text'><%= @hash['minitest']['total_errors'] %></span></div>
|
53
|
+
<% else %>
|
54
|
+
<div class="col-sm-3 offset-sm-2 badge-med-height badge badge-success"><span class='med-text'><%= @hash['minitest']['total_errors'] %></span></div>
|
55
|
+
<% end %>
|
56
|
+
<div class="col-sm-5 badge-med-height badge-text">Errors</div>
|
57
|
+
</div>
|
58
|
+
<% else %>
|
59
|
+
<div class="row pt-5">
|
60
|
+
<div class="col-sm-6 offset-sm-3 badge-lg-height badge badge-warning badge-text"><i data-feather="alert-triangle" class="size48"></i><br><span class="pt-2">No Data</span> </div>
|
61
|
+
</div>
|
62
|
+
<% end %>
|
63
|
+
</div>
|
64
|
+
</div>
|
65
|
+
</div>
|
66
|
+
</div>
|
67
|
+
<div class="col-sm">
|
68
|
+
<div class="card donut">
|
69
|
+
<div class="card-block">
|
70
|
+
<div class="card-body">
|
71
|
+
<h5 class="card-title">OpenStudio Style</h5>
|
72
|
+
<% if @hash['openstudio_style'] %>
|
73
|
+
<div class="canvas-container">
|
74
|
+
<canvas id="style"></canvas>
|
75
|
+
<span id="styleTotal" class="status adjust-pos">issues</span>
|
76
|
+
</div>
|
77
|
+
<% else %>
|
78
|
+
<div class="row pt-5">
|
79
|
+
<div class="col-sm-6 offset-sm-3 badge-lg-height badge badge-warning badge-text"><i data-feather="alert-triangle" class="size48"></i><br><span class="pt-2">No Data</span> </div>
|
80
|
+
</div>
|
81
|
+
<% end %>
|
82
|
+
</div>
|
83
|
+
</div>
|
84
|
+
</div>
|
85
|
+
</div>
|
86
|
+
<div class="col-sm">
|
87
|
+
<div class="card donut">
|
88
|
+
<div class="card-block">
|
89
|
+
<div class="card-body">
|
90
|
+
<h5 class="card-title">RuboCop</h5>
|
91
|
+
<% if @hash['rubocop'] %>
|
92
|
+
<div class="canvas-container">
|
93
|
+
<canvas id="rubocop"></canvas>
|
94
|
+
<span id="ruboTotal" class="status adjust-pos">issues</span>
|
95
|
+
</div>
|
96
|
+
<% else %>
|
97
|
+
<div class="row pt-5">
|
98
|
+
<div class="col-sm-6 offset-sm-3 badge-lg-height badge badge-warning badge-text"><i data-feather="alert-triangle" class="size48"></i><br><span class="pt-2">No Data</span> </div>
|
99
|
+
</div>
|
100
|
+
<% end %>
|
101
|
+
</div>
|
102
|
+
</div>
|
103
|
+
</div>
|
104
|
+
</div>
|
105
|
+
<div class="col-sm">
|
106
|
+
<div class="card donut">
|
107
|
+
<div class="card-block">
|
108
|
+
<div class="card-body">
|
109
|
+
<h5 class="card-title">Coverage</h5>
|
110
|
+
<% if @hash['coverage'] %>
|
111
|
+
<div class="canvas-container">
|
112
|
+
<canvas id="cov"></canvas>
|
113
|
+
<span id="covPercent" class="status">%</span>
|
114
|
+
</div>
|
115
|
+
<% else %>
|
116
|
+
<div class="row pt-5">
|
117
|
+
<div class="col-sm-6 offset-sm-3 badge-lg-height badge badge-warning badge-text"><i data-feather="alert-triangle" class="size48"></i><br><span class="pt-2">No Data</span> </div>
|
118
|
+
</div>
|
119
|
+
<% end %>
|
120
|
+
</div>
|
121
|
+
</div>
|
122
|
+
</div>
|
123
|
+
</div>
|
124
|
+
</div>
|
125
|
+
<div class="py-5">
|
126
|
+
<h2 class="accent">Measures</h2>
|
127
|
+
<div class="table-responsive">
|
128
|
+
<table class="table table-striped table-sm table-text">
|
129
|
+
<thead>
|
130
|
+
<tr>
|
131
|
+
<th>Measure Name</th>
|
132
|
+
<th>Tests<br/><span class="small-text">Passed - Failures - Errors</span></th>
|
133
|
+
<th>OS Style Errors<br/><span class="small-text">Errors - Warnings - Info</span></th>
|
134
|
+
<th>RuboCop<br/><span class="small-text">Errors - Warnings - Info</span></th>
|
135
|
+
<th>Coverage</th>
|
136
|
+
<th> </th>
|
137
|
+
</tr>
|
138
|
+
</thead>
|
139
|
+
<tbody>
|
140
|
+
<!-- use the largest 'by_measure' array, in case the tests weren't all run (coverage & minitest run together) -->
|
141
|
+
<% max = 0 %>
|
142
|
+
<% test_type = ''%>
|
143
|
+
<% ['coverage', 'openstudio_style', 'rubocop'].each do |type| %>
|
144
|
+
<% if @hash[type] && @hash[type]['by_measure'] %>
|
145
|
+
<% if @hash[type]['by_measure'].length > max %>
|
146
|
+
<% max = @hash[type]['by_measure'].length %>
|
147
|
+
<% test_type = type %>
|
148
|
+
<% end %>
|
149
|
+
<% end %>
|
150
|
+
<% end %>
|
151
|
+
<% if test_type != '' %>
|
152
|
+
<% @hash[test_type]['by_measure'].each do |name, measure| %>
|
153
|
+
<tr>
|
154
|
+
<td><%= name %></td>
|
155
|
+
<td>
|
156
|
+
<% if @hash['minitest'] && @hash['minitest']['by_measure'] && @hash['minitest']['by_measure'][name] %>
|
157
|
+
<% passed = @hash['minitest']['by_measure'][name]['measure_tests'] - (@hash['minitest']['by_measure'][name]['measure_failures'] + @hash['minitest']['by_measure'][name]['measure_errors'] + @hash['minitest']['by_measure'][name]['measure_skipped']) %>
|
158
|
+
<span class="badge badge-success"><%= passed %></span>
|
159
|
+
<% if @hash['minitest']['by_measure'][name]['measure_failures'] > 0 %>
|
160
|
+
<% label = 'danger' %>
|
161
|
+
<% else %>
|
162
|
+
<% label = 'success' %>
|
163
|
+
<% end %>
|
164
|
+
<span class="badge badge-<%= label %>"><%= @hash['minitest']['by_measure'][name]['measure_failures'] %></span>
|
165
|
+
<% if @hash['minitest']['by_measure'][name]['measure_errors'] > 0 %>
|
166
|
+
<% label = 'danger' %>
|
167
|
+
<% else %>
|
168
|
+
<% label = 'success' %>
|
169
|
+
<% end %>
|
170
|
+
<span class="badge badge-<%= label %>"><%= @hash['minitest']['by_measure'][name]['measure_errors'] %></span>
|
171
|
+
<% end %>
|
172
|
+
</td>
|
173
|
+
<td>
|
174
|
+
<% if @hash['openstudio_style'] && @hash['openstudio_style']['by_measure'][name] %>
|
175
|
+
<% if @hash['openstudio_style']['by_measure'][name]['measure_errors'] > 0 %>
|
176
|
+
<span class="badge badge-danger"><%= @hash['openstudio_style']['by_measure'][name]['measure_errors'] %></span>
|
177
|
+
<% elsif @hash['openstudio_style']['by_measure'][name]['measure_errors'] == 0 %>
|
178
|
+
<span class="badge badge-success"><%= @hash['openstudio_style']['by_measure'][name]['measure_errors'] %></span>
|
179
|
+
<% end %>
|
180
|
+
<% if @hash['openstudio_style']['by_measure'][name]['measure_warnings'] > 0 %>
|
181
|
+
<span class="badge badge-warning"><%= @hash['openstudio_style']['by_measure'][name]['measure_warnings'] %></span>
|
182
|
+
<% end %>
|
183
|
+
<% if @hash['openstudio_style']['by_measure'][name]['measure_info'] > 0 %>
|
184
|
+
<span class="badge badge-info"><%= @hash['openstudio_style']['by_measure'][name]['measure_info'] %></span>
|
185
|
+
<% end %>
|
186
|
+
<% end %>
|
187
|
+
</td>
|
188
|
+
<td>
|
189
|
+
<% if @hash['rubocop'] && @hash['rubocop']['by_measure'][name] %>
|
190
|
+
<% if @hash['rubocop']['by_measure'][name]['measure_errors'] > 0 %>
|
191
|
+
<span class="badge badge-danger"><%= @hash['rubocop']['by_measure'][name]['measure_errors'] %></span>
|
192
|
+
<% elsif @hash['rubocop']['by_measure'][name]['measure_errors'] == 0 %>
|
193
|
+
<span class="badge badge-success"><%= @hash['rubocop']['by_measure'][name]['measure_errors'] %></span>
|
194
|
+
<% end %>
|
195
|
+
<% if @hash['rubocop']['by_measure'][name]['measure_warnings'] > 0 %>
|
196
|
+
<span class="badge badge-warning"><%= @hash['rubocop']['by_measure'][name]['measure_warnings'] %></span>
|
197
|
+
<% end %>
|
198
|
+
<% if @hash['rubocop']['by_measure'][name]['measure_info'] > 0 %>
|
199
|
+
<span class="badge badge-info"><%= @hash['rubocop']['by_measure'][name]['measure_info'] %></span>
|
200
|
+
<% end %>
|
201
|
+
<% end %>
|
202
|
+
</td>
|
203
|
+
<td><% if @hash['coverage'] && @hash['coverage']['by_measure'][name] %>
|
204
|
+
<% if @hash['coverage']['by_measure'][name]['percent_coverage'] >= 80 %>
|
205
|
+
<% label = 'success' %>
|
206
|
+
<% elsif @hash['coverage']['by_measure'][name]['percent_coverage'] >= 60 %>
|
207
|
+
<% label = 'warning' %>
|
208
|
+
<% else %>
|
209
|
+
<% label = 'danger' %>
|
210
|
+
<% end %>
|
211
|
+
<span class="badge badge-<%=label %>"><%= @hash['coverage']['by_measure'][name]['percent_coverage'] %> % </span>
|
212
|
+
<% end %></td>
|
213
|
+
<td><button type="button" class="btn btn-accent" data-toggle="modal" data-target="#<%= name %>">
|
214
|
+
View Details
|
215
|
+
</button></td>
|
216
|
+
</tr>
|
217
|
+
<% end %>
|
218
|
+
<% end %>
|
219
|
+
</tbody>
|
220
|
+
</table>
|
221
|
+
</div>
|
222
|
+
</div>
|
223
|
+
</main>
|
224
|
+
</div>
|
225
|
+
</div>
|
226
|
+
<% if test_type != '' %>
|
227
|
+
<% @hash[test_type]['by_measure'].each do |name, measure| %>
|
228
|
+
<div class="modal fade" id="<%= name %>" tabindex="-1" role="dialog" aria-labelledby="modalLabel" aria-hidden="true">
|
229
|
+
<div class="modal-dialog modal-measure" role="document">
|
230
|
+
<div class="modal-content">
|
231
|
+
<div class="modal-header btn-accent">
|
232
|
+
<h5 class="modal-title" id="modalLabel"><%= name %></h5>
|
233
|
+
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
234
|
+
<span aria-hidden="true">×</span>
|
235
|
+
</button>
|
236
|
+
</div>
|
237
|
+
<div class="modal-body">
|
238
|
+
<div class="row pb-3">
|
239
|
+
<div class="col-sm-12">
|
240
|
+
<% if @hash['coverage'] && @hash['coverage']['by_measure'][name] %>
|
241
|
+
<% if @hash['coverage']['by_measure'][name]['percent_coverage'] >= 80 %>
|
242
|
+
<% label = 'success' %>
|
243
|
+
<% elsif @hash['coverage']['by_measure'][name]['percent_coverage'] >= 60 %>
|
244
|
+
<% label = 'warning' %>
|
245
|
+
<% else %>
|
246
|
+
<% label = 'danger' %>
|
247
|
+
<% end %>
|
248
|
+
<h4>Coverage
|
249
|
+
<span class="badge badge-<%= label %>"><%= @hash['coverage']['by_measure'][name]['percent_coverage'] %>%</span>
|
250
|
+
</h4>
|
251
|
+
<% else %>
|
252
|
+
<h4>Coverage</h4>
|
253
|
+
<% end %>
|
254
|
+
</div>
|
255
|
+
</div>
|
256
|
+
<div class="row pb-2">
|
257
|
+
<div class="col-sm-12">
|
258
|
+
<% if @hash['coverage'] && @hash['coverage']['by_measure'][name] %>
|
259
|
+
<table class="table table-striped">
|
260
|
+
<thead>
|
261
|
+
<tr>
|
262
|
+
<th>File</th>
|
263
|
+
<th>Coverage</th>
|
264
|
+
</tr>
|
265
|
+
</thead>
|
266
|
+
<tbody>
|
267
|
+
<% @hash['coverage']['by_measure'][name]['files'].each do |file| %>
|
268
|
+
<% if file['percent_coverage'] >= 80 %>
|
269
|
+
<% label = 'success' %>
|
270
|
+
<% elsif file['percent_coverage'] >= 60 %>
|
271
|
+
<% label = 'warning' %>
|
272
|
+
<% else %>
|
273
|
+
<% label = 'danger' %>
|
274
|
+
<% end %>
|
275
|
+
<tr>
|
276
|
+
<td><%= file['name'] %></td>
|
277
|
+
<td><span class="badge badge-<%= label %>"><%= file['percent_coverage'] %>%</span></td>
|
278
|
+
</tr>
|
279
|
+
<% end %>
|
280
|
+
</tbody>
|
281
|
+
</table>
|
282
|
+
<% else %>
|
283
|
+
<span class="badge badge-danger">NO DATA</span> Test was not run
|
284
|
+
<% end %>
|
285
|
+
</div>
|
286
|
+
</div>
|
287
|
+
|
288
|
+
<div class="row pb-3">
|
289
|
+
<div class="col-sm-12">
|
290
|
+
<h4>OpenStudio Style</h4>
|
291
|
+
<% if @hash['openstudio_style'] && @hash['openstudio_style']['by_measure'] && @hash['openstudio_style']['by_measure'][name] && @hash['openstudio_style']['by_measure'][name]['issues'] %>
|
292
|
+
<% if @hash['openstudio_style']['by_measure'][name]['issues'].length == 0 %>
|
293
|
+
<div>No errors</div>
|
294
|
+
<% else %>
|
295
|
+
<table class="table table-striped">
|
296
|
+
<thead>
|
297
|
+
<tr>
|
298
|
+
<th>Severity</th>
|
299
|
+
<th>Type</th>
|
300
|
+
<th>Message</th>
|
301
|
+
</tr>
|
302
|
+
</thead>
|
303
|
+
<tbody>
|
304
|
+
<% @hash['openstudio_style']['by_measure'][name]['issues'].each do |issue| %>
|
305
|
+
<tr>
|
306
|
+
<td>
|
307
|
+
<span class="badge badge-<%= issue['severity'] %>"><%= issue['severity'] %></span>
|
308
|
+
</td>
|
309
|
+
<td>
|
310
|
+
<%= issue['type'] %>
|
311
|
+
</td>
|
312
|
+
<td><%= issue['message'] %></td>
|
313
|
+
</tr>
|
314
|
+
<% end %>
|
315
|
+
</tbody>
|
316
|
+
</table>
|
317
|
+
<% end %>
|
318
|
+
<% else %>
|
319
|
+
<div>
|
320
|
+
<span class="badge badge-danger">NO DATA</span> Test was not run
|
321
|
+
</div>
|
322
|
+
<% end %>
|
323
|
+
</div>
|
324
|
+
</div>
|
325
|
+
|
326
|
+
<div class="row pb-3">
|
327
|
+
<div class="col-sm-12">
|
328
|
+
<h4>Tests</h4>
|
329
|
+
<% if @hash['minitest'] && @hash['minitest']['by_measure'] && @hash['minitest']['by_measure'][name] && @hash['minitest']['by_measure'][name]['issues'] %>
|
330
|
+
<% if @hash['minitest']['by_measure'][name]['issues']['failures'].length > 0 || @hash['minitest']['by_measure'][name]['issues']['errors'].length > 0 %>
|
331
|
+
<table class="table table-striped">
|
332
|
+
<thead>
|
333
|
+
<tr>
|
334
|
+
<th>Severity</th>
|
335
|
+
<th>Message</th>
|
336
|
+
</tr>
|
337
|
+
</thead>
|
338
|
+
<tbody>
|
339
|
+
<% @hash['minitest']['by_measure'][name]['issues']['failures'].each do |failure| %>
|
340
|
+
<tr>
|
341
|
+
<td><span class="badge badge-danger">Failure</span></td>
|
342
|
+
<td><%= failure %></td>
|
343
|
+
</tr>
|
344
|
+
<% end %>
|
345
|
+
<% @hash['minitest']['by_measure'][name]['issues']['errors'].each do |err| %>
|
346
|
+
<tr>
|
347
|
+
<td><span class="badge badge-dark">Error</span></td>
|
348
|
+
<td><%= err %></td>
|
349
|
+
</tr>
|
350
|
+
<% end %>
|
351
|
+
</tbody>
|
352
|
+
</table>
|
353
|
+
<% else %>
|
354
|
+
<div> <span class="badge badge-success">All passed</span></div>
|
355
|
+
<% end %>
|
356
|
+
<% else %>
|
357
|
+
<div>
|
358
|
+
<span class="badge badge-danger">NO DATA</span> Test was not run
|
359
|
+
</div>
|
360
|
+
<% end %>
|
361
|
+
</div>
|
362
|
+
</div>
|
363
|
+
|
364
|
+
<div class="row pb-3">
|
365
|
+
<div class="col-sm-12">
|
366
|
+
<h4>RuboCop</h4>
|
367
|
+
<% if @hash['rubocop'] && @hash['rubocop']['by_measure'] && @hash['rubocop']['by_measure'][name] %>
|
368
|
+
<div class="py-2">
|
369
|
+
<span class="badge badge-info"><%= @hash['rubocop']['by_measure'][name]['measure_issues'] %></span> total violations
|
370
|
+
</div>
|
371
|
+
<% @hash['rubocop']['by_measure'][name]['files'].each_with_index do |file, findex| %>
|
372
|
+
<% if @hash['rubocop']['by_measure'][name]['files'][findex]['violations'].length > 0 %>
|
373
|
+
<div class="pb-1">
|
374
|
+
<button class="btn btn-info" type="button" data-toggle="collapse" data-target="#file-<%=file['file_name']%>" aria-expanded="false" aria-controls="<%=file['file_name'] %>">
|
375
|
+
<%= file['file_name'] %>
|
376
|
+
</button>
|
377
|
+
</div>
|
378
|
+
<div class="collapse" id="file-<%= file['file_name'] %>">
|
379
|
+
<div class="p-1">
|
380
|
+
<table class="table table-striped">
|
381
|
+
<thead>
|
382
|
+
<tr>
|
383
|
+
<th>Severity</th>
|
384
|
+
<th>Line, Col</th>
|
385
|
+
<th>Message</th>
|
386
|
+
</tr>
|
387
|
+
</thead>
|
388
|
+
<tbody>
|
389
|
+
<% @hash['rubocop']['by_measure'][name]['files'][findex]['violations'].each do |issue| %>
|
390
|
+
<tr>
|
391
|
+
<td><span class="badge badge-<%= issue['severity'] %>"><%= issue['severity'] %></span></td>
|
392
|
+
<td><%= issue['line'] %>, <%= issue['column'] %></td>
|
393
|
+
<td><%= issue['message'] %></td>
|
394
|
+
</tr>
|
395
|
+
<% end %>
|
396
|
+
</tbody>
|
397
|
+
</table>
|
398
|
+
</div>
|
399
|
+
</div>
|
400
|
+
<% else %>
|
401
|
+
<div>No errors</div>
|
402
|
+
<% end %>
|
403
|
+
<% end %>
|
404
|
+
<% else %>
|
405
|
+
<div>
|
406
|
+
<span class="badge badge-danger">NO DATA</span> Test was not run
|
407
|
+
</div>
|
408
|
+
<% end %>
|
409
|
+
</div>
|
410
|
+
</div>
|
411
|
+
</div>
|
412
|
+
<div class="modal-footer">
|
413
|
+
<button type="button" class="btn btn-accent" data-dismiss="modal">Close</button>
|
414
|
+
</div>
|
415
|
+
</div>
|
416
|
+
</div>
|
417
|
+
</div>
|
418
|
+
<% end %>
|
419
|
+
<% end %>
|
420
|
+
|
421
|
+
<!-- Bootstrap core JavaScript
|
422
|
+
================================================== -->
|
423
|
+
<!-- Placed at the end of the document so the pages load faster -->
|
424
|
+
<script src="js/jquery-3.3.1.min.js"></script>
|
425
|
+
<script src="js/bootstrap.min.js"></script>
|
426
|
+
|
427
|
+
<!-- Icons -->
|
428
|
+
<script src="https://unpkg.com/feather-icons/dist/feather.min.js"></script>
|
429
|
+
<script>
|
430
|
+
feather.replace()
|
431
|
+
</script>
|
432
|
+
|
433
|
+
<!-- Graphs -->
|
434
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.1/Chart.min.js"></script>
|
435
|
+
<script>
|
436
|
+
(function(){
|
437
|
+
var t;
|
438
|
+
|
439
|
+
function size(animate){
|
440
|
+
if (animate == undefined){
|
441
|
+
animate = false;
|
442
|
+
}
|
443
|
+
clearTimeout(t);
|
444
|
+
t = setTimeout(function(){
|
445
|
+
$("canvas").each(function(i,el){
|
446
|
+
$(el).attr({
|
447
|
+
"width":$(el).parent().width(),
|
448
|
+
"height":$(el).parent().outerHeight()
|
449
|
+
});
|
450
|
+
});
|
451
|
+
redraw(animate);
|
452
|
+
var m = 0;
|
453
|
+
$(".card").height("");
|
454
|
+
$(".card").each(function(i,el){ m = Math.max(m,$(el).height()); });
|
455
|
+
$(".card").height(m);
|
456
|
+
}, 30);
|
457
|
+
}
|
458
|
+
$(window).on('resize', function(){ size(false); });
|
459
|
+
|
460
|
+
|
461
|
+
function redraw(animation){
|
462
|
+
var data = <%= @data %>;
|
463
|
+
console.log('DATA: ', data);
|
464
|
+
|
465
|
+
var options = {animation:{}};
|
466
|
+
if (!animation){
|
467
|
+
options.animation.animateRotate = false;
|
468
|
+
} else {
|
469
|
+
options.animation.animateRotate = true;
|
470
|
+
}
|
471
|
+
|
472
|
+
if ('coverage' in data) {
|
473
|
+
var covData = data['coverage'];
|
474
|
+
// set % coverage
|
475
|
+
document.getElementById("covPercent").innerHTML = covData['total_percent_coverage'] + '%';
|
476
|
+
var dataCov = {
|
477
|
+
datasets:[{
|
478
|
+
data: [
|
479
|
+
covData['total_covered_lines'],
|
480
|
+
covData['total_missed_lines']
|
481
|
+
],
|
482
|
+
backgroundColor: [
|
483
|
+
"#50AE54",
|
484
|
+
"#F2453D"
|
485
|
+
]
|
486
|
+
}],
|
487
|
+
labels: [
|
488
|
+
"lines covered",
|
489
|
+
"lines missed",
|
490
|
+
]
|
491
|
+
};
|
492
|
+
|
493
|
+
var config = {type: 'doughnut', data: dataCov, options: options};
|
494
|
+
var canvas = document.getElementById("cov");
|
495
|
+
var ctx = canvas.getContext("2d");
|
496
|
+
var doughnut = new Chart(ctx, config);
|
497
|
+
|
498
|
+
}
|
499
|
+
|
500
|
+
if ('rubocop' in data) {
|
501
|
+
var ruboData = data['rubocop'];
|
502
|
+
// set total rubocop issues
|
503
|
+
document.getElementById("ruboTotal").innerHTML = ruboData['total_issues'] + '<br/> issues';
|
504
|
+
var dataRubocop = {
|
505
|
+
datasets:[{
|
506
|
+
data: [
|
507
|
+
ruboData['total_info'],
|
508
|
+
ruboData['total_warnings'],
|
509
|
+
ruboData['total_errors']
|
510
|
+
],
|
511
|
+
backgroundColor: [
|
512
|
+
"#25A2B7",
|
513
|
+
"#FDC02F",
|
514
|
+
"#DA3849"
|
515
|
+
]
|
516
|
+
}],
|
517
|
+
labels: [
|
518
|
+
"info",
|
519
|
+
"warnings",
|
520
|
+
"errors"
|
521
|
+
]
|
522
|
+
};
|
523
|
+
var config2 = {type: 'doughnut', data: dataRubocop, options: options};
|
524
|
+
var canvas2 = document.getElementById("rubocop");
|
525
|
+
var ctx2 = canvas2.getContext("2d");
|
526
|
+
var doughnut2 = new Chart(ctx2, config2);
|
527
|
+
}
|
528
|
+
if ('openstudio_style' in data) {
|
529
|
+
var styleData = data['openstudio_style'];
|
530
|
+
// set total style issues
|
531
|
+
var total = styleData['total_errors'] + styleData['total_info'] + styleData['total_warnings'];
|
532
|
+
|
533
|
+
document.getElementById("styleTotal").innerHTML = total + '<br/> issues';
|
534
|
+
var dataStyle = {
|
535
|
+
datasets:[{
|
536
|
+
data: [
|
537
|
+
styleData['total_info'],
|
538
|
+
styleData['total_warnings'],
|
539
|
+
styleData['total_errors']
|
540
|
+
],
|
541
|
+
backgroundColor: [
|
542
|
+
"#25A2B7",
|
543
|
+
"#FDC02F",
|
544
|
+
"#DA3849"
|
545
|
+
]
|
546
|
+
}],
|
547
|
+
labels: [
|
548
|
+
"info",
|
549
|
+
"warnings",
|
550
|
+
"errors"
|
551
|
+
]
|
552
|
+
};
|
553
|
+
var config3 = {type: 'doughnut', data: dataStyle, options: options};
|
554
|
+
var canvas3 = document.getElementById("style");
|
555
|
+
var ctx3 = canvas3.getContext("2d");
|
556
|
+
var doughnut3 = new Chart(ctx3, config3);
|
557
|
+
}
|
558
|
+
|
559
|
+
}
|
560
|
+
size(true);
|
561
|
+
|
562
|
+
}());
|
563
|
+
|
564
|
+
</script>
|
565
|
+
</body>
|
566
|
+
</html>
|