iain-metric_fu 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/HISTORY +159 -0
- data/MIT-LICENSE +22 -0
- data/Manifest +103 -0
- data/README +1 -0
- data/Rakefile +29 -0
- data/TODO +9 -0
- data/home_page/back_all.jpg +0 -0
- data/home_page/churn.gif +0 -0
- data/home_page/flay.gif +0 -0
- data/home_page/flog.gif +0 -0
- data/home_page/footer.gif +0 -0
- data/home_page/header.jpg +0 -0
- data/home_page/img09.gif +0 -0
- data/home_page/index.html +270 -0
- data/home_page/rcov.gif +0 -0
- data/home_page/reek.gif +0 -0
- data/home_page/roodi.gif +0 -0
- data/home_page/saikuro.gif +0 -0
- data/home_page/stats.gif +0 -0
- data/home_page/styles.css +245 -0
- data/home_page/title.gif +0 -0
- data/home_page/title_back.gif +0 -0
- data/lib/base/base_template.rb +146 -0
- data/lib/base/configuration.rb +187 -0
- data/lib/base/generator.rb +160 -0
- data/lib/base/graph.rb +38 -0
- data/lib/base/md5_tracker.rb +52 -0
- data/lib/base/report.rb +100 -0
- data/lib/generators/churn.rb +90 -0
- data/lib/generators/flay.rb +33 -0
- data/lib/generators/flog.rb +140 -0
- data/lib/generators/rcov.rb +87 -0
- data/lib/generators/reek.rb +37 -0
- data/lib/generators/roodi.rb +31 -0
- data/lib/generators/saikuro.rb +208 -0
- data/lib/generators/stats.rb +43 -0
- data/lib/graphs/flay_grapher.rb +35 -0
- data/lib/graphs/flog_grapher.rb +51 -0
- data/lib/graphs/grapher.rb +19 -0
- data/lib/graphs/rcov_grapher.rb +34 -0
- data/lib/graphs/reek_grapher.rb +44 -0
- data/lib/graphs/roodi_grapher.rb +34 -0
- data/lib/graphs/stats_grapher.rb +37 -0
- data/lib/metric_fu.rb +30 -0
- data/lib/templates/awesome/awesome_template.rb +30 -0
- data/lib/templates/awesome/churn.html.erb +19 -0
- data/lib/templates/awesome/css/buttons.css +82 -0
- data/lib/templates/awesome/css/default.css +81 -0
- data/lib/templates/awesome/css/integrity.css +335 -0
- data/lib/templates/awesome/css/reset.css +7 -0
- data/lib/templates/awesome/flay.html.erb +27 -0
- data/lib/templates/awesome/flog.html.erb +47 -0
- data/lib/templates/awesome/index.html.erb +28 -0
- data/lib/templates/awesome/js/sorttable.js +492 -0
- data/lib/templates/awesome/layout.html.erb +34 -0
- data/lib/templates/awesome/rcov.html.erb +36 -0
- data/lib/templates/awesome/reek.html.erb +34 -0
- data/lib/templates/awesome/roodi.html.erb +21 -0
- data/lib/templates/awesome/saikuro.html.erb +71 -0
- data/lib/templates/awesome/stats.html.erb +46 -0
- data/lib/templates/standard/churn.html.erb +31 -0
- data/lib/templates/standard/default.css +64 -0
- data/lib/templates/standard/flay.html.erb +34 -0
- data/lib/templates/standard/flog.html.erb +53 -0
- data/lib/templates/standard/index.html.erb +38 -0
- data/lib/templates/standard/rcov.html.erb +43 -0
- data/lib/templates/standard/reek.html.erb +42 -0
- data/lib/templates/standard/roodi.html.erb +29 -0
- data/lib/templates/standard/saikuro.html.erb +84 -0
- data/lib/templates/standard/standard_template.rb +26 -0
- data/lib/templates/standard/stats.html.erb +55 -0
- data/metric_fu.gemspec +42 -0
- data/spec/base/base_template_spec.rb +161 -0
- data/spec/base/configuration_spec.rb +300 -0
- data/spec/base/generator_spec.rb +181 -0
- data/spec/base/graph_spec.rb +24 -0
- data/spec/base/md5_tracker_spec.rb +57 -0
- data/spec/base/report_spec.rb +139 -0
- data/spec/generators/churn_spec.rb +152 -0
- data/spec/generators/flay_spec.rb +104 -0
- data/spec/generators/flog_spec.rb +219 -0
- data/spec/generators/reek_spec.rb +60 -0
- data/spec/generators/saikuro_spec.rb +58 -0
- data/spec/generators/stats_spec.rb +74 -0
- data/spec/graphs/flay_grapher_spec.rb +44 -0
- data/spec/graphs/flog_grapher_spec.rb +61 -0
- data/spec/graphs/grapher_spec.rb +9 -0
- data/spec/graphs/rcov_grapher_spec.rb +44 -0
- data/spec/graphs/reek_grapher_spec.rb +53 -0
- data/spec/graphs/roodi_grapher_spec.rb +44 -0
- data/spec/graphs/stats_grapher_spec.rb +60 -0
- data/spec/resources/saikuro/app/controllers/sessions_controller.rb_cyclo.html +10 -0
- data/spec/resources/saikuro/app/controllers/users_controller.rb_cyclo.html +16 -0
- data/spec/resources/saikuro/index_cyclo.html +155 -0
- data/spec/resources/saikuro_sfiles/thing.rb_cyclo.html +11 -0
- data/spec/resources/yml/20090630.yml +7844 -0
- data/spec/resources/yml/20090822.yml +8342 -0
- data/spec/spec.opts +8 -0
- data/spec/spec_helper.rb +6 -0
- data/tasks/metric_fu.rake +22 -0
- data/vendor/_fonts/monaco.ttf +0 -0
- data/vendor/saikuro/SAIKURO_README +142 -0
- data/vendor/saikuro/saikuro.rb +1219 -0
- metadata +251 -0
@@ -0,0 +1,492 @@
|
|
1
|
+
/*
|
2
|
+
SortTable
|
3
|
+
version 2
|
4
|
+
7th April 2007
|
5
|
+
Stuart Langridge, http://www.kryogenix.org/code/browser/sorttable/
|
6
|
+
|
7
|
+
Instructions:
|
8
|
+
Download this file
|
9
|
+
Add class="sortable" to any table you'd like to make sortable
|
10
|
+
Click on the headers to sort
|
11
|
+
|
12
|
+
Thanks to many, many people for contributions and suggestions.
|
13
|
+
Licenced as X11: http://www.kryogenix.org/code/browser/licence.html
|
14
|
+
This basically means: do what you want with it.
|
15
|
+
*/
|
16
|
+
|
17
|
+
|
18
|
+
var stIsIE = /*@cc_on!@*/false;
|
19
|
+
|
20
|
+
sorttable = {
|
21
|
+
init: function() {
|
22
|
+
// quit if this function has already been called
|
23
|
+
if (arguments.callee.done) return;
|
24
|
+
// flag this function so we don't do the same thing twice
|
25
|
+
arguments.callee.done = true;
|
26
|
+
// kill the timer
|
27
|
+
if (_timer) clearInterval(_timer);
|
28
|
+
|
29
|
+
if (!document.createElement || !document.getElementsByTagName) return;
|
30
|
+
|
31
|
+
sorttable.DATE_RE = /^(\d\d?)[\/\.-](\d\d?)[\/\.-]((\d\d)?\d\d)$/;
|
32
|
+
|
33
|
+
forEach(document.getElementsByTagName('table'), function(table) {
|
34
|
+
if (table.className.search(/\bsortable\b/) != -1) {
|
35
|
+
sorttable.makeSortable(table);
|
36
|
+
}
|
37
|
+
});
|
38
|
+
|
39
|
+
},
|
40
|
+
|
41
|
+
makeSortable: function(table) {
|
42
|
+
if (table.getElementsByTagName('thead').length == 0) {
|
43
|
+
// table doesn't have a tHead. Since it should have, create one and
|
44
|
+
// put the first table row in it.
|
45
|
+
the = document.createElement('thead');
|
46
|
+
the.appendChild(table.rows[0]);
|
47
|
+
table.insertBefore(the,table.firstChild);
|
48
|
+
}
|
49
|
+
// Safari doesn't support table.tHead, sigh
|
50
|
+
if (table.tHead == null) table.tHead = table.getElementsByTagName('thead')[0];
|
51
|
+
|
52
|
+
if (table.tHead.rows.length != 1) return; // can't cope with two header rows
|
53
|
+
|
54
|
+
// Sorttable v1 put rows with a class of "sortbottom" at the bottom (as
|
55
|
+
// "total" rows, for example). This is B&R, since what you're supposed
|
56
|
+
// to do is put them in a tfoot. So, if there are sortbottom rows,
|
57
|
+
// for backwards compatibility, move them to tfoot (creating it if needed).
|
58
|
+
sortbottomrows = [];
|
59
|
+
for (var i=0; i<table.rows.length; i++) {
|
60
|
+
if (table.rows[i].className.search(/\bsortbottom\b/) != -1) {
|
61
|
+
sortbottomrows[sortbottomrows.length] = table.rows[i];
|
62
|
+
}
|
63
|
+
}
|
64
|
+
if (sortbottomrows) {
|
65
|
+
if (table.tFoot == null) {
|
66
|
+
// table doesn't have a tfoot. Create one.
|
67
|
+
tfo = document.createElement('tfoot');
|
68
|
+
table.appendChild(tfo);
|
69
|
+
}
|
70
|
+
for (var i=0; i<sortbottomrows.length; i++) {
|
71
|
+
tfo.appendChild(sortbottomrows[i]);
|
72
|
+
}
|
73
|
+
delete sortbottomrows;
|
74
|
+
}
|
75
|
+
|
76
|
+
// work through each column and calculate its type
|
77
|
+
headrow = table.tHead.rows[0].cells;
|
78
|
+
for (var i=0; i<headrow.length; i++) {
|
79
|
+
// manually override the type with a sorttable_type attribute
|
80
|
+
if (!headrow[i].className.match(/\bsorttable_nosort\b/)) { // skip this col
|
81
|
+
mtch = headrow[i].className.match(/\bsorttable_([a-z0-9]+)\b/);
|
82
|
+
if (mtch) { override = mtch[1]; }
|
83
|
+
if (mtch && typeof sorttable["sort_"+override] == 'function') {
|
84
|
+
headrow[i].sorttable_sortfunction = sorttable["sort_"+override];
|
85
|
+
} else {
|
86
|
+
headrow[i].sorttable_sortfunction = sorttable.guessType(table,i);
|
87
|
+
}
|
88
|
+
// make it clickable to sort
|
89
|
+
headrow[i].sorttable_columnindex = i;
|
90
|
+
headrow[i].sorttable_tbody = table.tBodies[0];
|
91
|
+
dean_addEvent(headrow[i],"click", function(e) {
|
92
|
+
|
93
|
+
if (this.className.search(/\bsorttable_sorted\b/) != -1) {
|
94
|
+
// if we're already sorted by this column, just
|
95
|
+
// reverse the table, which is quicker
|
96
|
+
sorttable.reverse(this.sorttable_tbody);
|
97
|
+
this.className = this.className.replace('sorttable_sorted',
|
98
|
+
'sorttable_sorted_reverse');
|
99
|
+
this.removeChild(document.getElementById('sorttable_sortfwdind'));
|
100
|
+
sortrevind = document.createElement('span');
|
101
|
+
sortrevind.id = "sorttable_sortrevind";
|
102
|
+
sortrevind.innerHTML = stIsIE ? ' <font face="webdings">5</font>' : ' ▴';
|
103
|
+
this.appendChild(sortrevind);
|
104
|
+
return;
|
105
|
+
}
|
106
|
+
if (this.className.search(/\bsorttable_sorted_reverse\b/) != -1) {
|
107
|
+
// if we're already sorted by this column in reverse, just
|
108
|
+
// re-reverse the table, which is quicker
|
109
|
+
sorttable.reverse(this.sorttable_tbody);
|
110
|
+
this.className = this.className.replace('sorttable_sorted_reverse',
|
111
|
+
'sorttable_sorted');
|
112
|
+
this.removeChild(document.getElementById('sorttable_sortrevind'));
|
113
|
+
sortfwdind = document.createElement('span');
|
114
|
+
sortfwdind.id = "sorttable_sortfwdind";
|
115
|
+
sortfwdind.innerHTML = stIsIE ? ' <font face="webdings">6</font>' : ' ▾';
|
116
|
+
this.appendChild(sortfwdind);
|
117
|
+
return;
|
118
|
+
}
|
119
|
+
|
120
|
+
// remove sorttable_sorted classes
|
121
|
+
theadrow = this.parentNode;
|
122
|
+
forEach(theadrow.childNodes, function(cell) {
|
123
|
+
if (cell.nodeType == 1) { // an element
|
124
|
+
cell.className = cell.className.replace('sorttable_sorted_reverse','');
|
125
|
+
cell.className = cell.className.replace('sorttable_sorted','');
|
126
|
+
}
|
127
|
+
});
|
128
|
+
sortfwdind = document.getElementById('sorttable_sortfwdind');
|
129
|
+
if (sortfwdind) { sortfwdind.parentNode.removeChild(sortfwdind); }
|
130
|
+
sortrevind = document.getElementById('sorttable_sortrevind');
|
131
|
+
if (sortrevind) { sortrevind.parentNode.removeChild(sortrevind); }
|
132
|
+
|
133
|
+
this.className += ' sorttable_sorted';
|
134
|
+
sortfwdind = document.createElement('span');
|
135
|
+
sortfwdind.id = "sorttable_sortfwdind";
|
136
|
+
sortfwdind.innerHTML = stIsIE ? ' <font face="webdings">6</font>' : ' ▾';
|
137
|
+
this.appendChild(sortfwdind);
|
138
|
+
|
139
|
+
// build an array to sort. This is a Schwartzian transform thing,
|
140
|
+
// i.e., we "decorate" each row with the actual sort key,
|
141
|
+
// sort based on the sort keys, and then put the rows back in order
|
142
|
+
// which is a lot faster because you only do getInnerText once per row
|
143
|
+
row_array = [];
|
144
|
+
col = this.sorttable_columnindex;
|
145
|
+
rows = this.sorttable_tbody.rows;
|
146
|
+
for (var j=0; j<rows.length; j++) {
|
147
|
+
row_array[row_array.length] = [sorttable.getInnerText(rows[j].cells[col]), rows[j]];
|
148
|
+
}
|
149
|
+
/* If you want a stable sort, uncomment the following line */
|
150
|
+
//sorttable.shaker_sort(row_array, this.sorttable_sortfunction);
|
151
|
+
/* and comment out this one */
|
152
|
+
row_array.sort(this.sorttable_sortfunction);
|
153
|
+
|
154
|
+
tb = this.sorttable_tbody;
|
155
|
+
for (var j=0; j<row_array.length; j++) {
|
156
|
+
tb.appendChild(row_array[j][1]);
|
157
|
+
}
|
158
|
+
|
159
|
+
delete row_array;
|
160
|
+
});
|
161
|
+
}
|
162
|
+
}
|
163
|
+
},
|
164
|
+
|
165
|
+
guessType: function(table, column) {
|
166
|
+
// guess the type of a column based on its first non-blank row
|
167
|
+
sortfn = sorttable.sort_alpha;
|
168
|
+
for (var i=0; i<table.tBodies[0].rows.length; i++) {
|
169
|
+
text = sorttable.getInnerText(table.tBodies[0].rows[i].cells[column]);
|
170
|
+
if (text != '') {
|
171
|
+
if (text.match(/^-?[�$�]?[\d,.]+%?$/)) {
|
172
|
+
return sorttable.sort_numeric;
|
173
|
+
}
|
174
|
+
// check for a date: dd/mm/yyyy or dd/mm/yy
|
175
|
+
// can have / or . or - as separator
|
176
|
+
// can be mm/dd as well
|
177
|
+
possdate = text.match(sorttable.DATE_RE)
|
178
|
+
if (possdate) {
|
179
|
+
// looks like a date
|
180
|
+
first = parseInt(possdate[1]);
|
181
|
+
second = parseInt(possdate[2]);
|
182
|
+
if (first > 12) {
|
183
|
+
// definitely dd/mm
|
184
|
+
return sorttable.sort_ddmm;
|
185
|
+
} else if (second > 12) {
|
186
|
+
return sorttable.sort_mmdd;
|
187
|
+
} else {
|
188
|
+
// looks like a date, but we can't tell which, so assume
|
189
|
+
// that it's dd/mm (English imperialism!) and keep looking
|
190
|
+
sortfn = sorttable.sort_ddmm;
|
191
|
+
}
|
192
|
+
}
|
193
|
+
}
|
194
|
+
}
|
195
|
+
return sortfn;
|
196
|
+
},
|
197
|
+
|
198
|
+
getInnerText: function(node) {
|
199
|
+
// gets the text we want to use for sorting for a cell.
|
200
|
+
// strips leading and trailing whitespace.
|
201
|
+
// this is *not* a generic getInnerText function; it's special to sorttable.
|
202
|
+
// for example, you can override the cell text with a customkey attribute.
|
203
|
+
// it also gets .value for <input> fields.
|
204
|
+
|
205
|
+
hasInputs = (typeof node.getElementsByTagName == 'function') &&
|
206
|
+
node.getElementsByTagName('input').length;
|
207
|
+
|
208
|
+
if (node.getAttribute("sorttable_customkey") != null) {
|
209
|
+
return node.getAttribute("sorttable_customkey");
|
210
|
+
}
|
211
|
+
else if (typeof node.textContent != 'undefined' && !hasInputs) {
|
212
|
+
return node.textContent.replace(/^\s+|\s+$/g, '');
|
213
|
+
}
|
214
|
+
else if (typeof node.innerText != 'undefined' && !hasInputs) {
|
215
|
+
return node.innerText.replace(/^\s+|\s+$/g, '');
|
216
|
+
}
|
217
|
+
else if (typeof node.text != 'undefined' && !hasInputs) {
|
218
|
+
return node.text.replace(/^\s+|\s+$/g, '');
|
219
|
+
}
|
220
|
+
else {
|
221
|
+
switch (node.nodeType) {
|
222
|
+
case 3:
|
223
|
+
if (node.nodeName.toLowerCase() == 'input') {
|
224
|
+
return node.value.replace(/^\s+|\s+$/g, '');
|
225
|
+
}
|
226
|
+
case 4:
|
227
|
+
return node.nodeValue.replace(/^\s+|\s+$/g, '');
|
228
|
+
break;
|
229
|
+
case 1:
|
230
|
+
case 11:
|
231
|
+
var innerText = '';
|
232
|
+
for (var i = 0; i < node.childNodes.length; i++) {
|
233
|
+
innerText += sorttable.getInnerText(node.childNodes[i]);
|
234
|
+
}
|
235
|
+
return innerText.replace(/^\s+|\s+$/g, '');
|
236
|
+
break;
|
237
|
+
default:
|
238
|
+
return '';
|
239
|
+
}
|
240
|
+
}
|
241
|
+
},
|
242
|
+
|
243
|
+
reverse: function(tbody) {
|
244
|
+
// reverse the rows in a tbody
|
245
|
+
newrows = [];
|
246
|
+
for (var i=0; i<tbody.rows.length; i++) {
|
247
|
+
newrows[newrows.length] = tbody.rows[i];
|
248
|
+
}
|
249
|
+
for (var i=newrows.length-1; i>=0; i--) {
|
250
|
+
tbody.appendChild(newrows[i]);
|
251
|
+
}
|
252
|
+
delete newrows;
|
253
|
+
},
|
254
|
+
|
255
|
+
/* sort functions
|
256
|
+
each sort function takes two parameters, a and b
|
257
|
+
you are comparing a[0] and b[0] */
|
258
|
+
sort_numeric: function(a,b) {
|
259
|
+
aa = parseFloat(a[0].replace(/[^0-9.-]/g,''));
|
260
|
+
if (isNaN(aa)) aa = 0;
|
261
|
+
bb = parseFloat(b[0].replace(/[^0-9.-]/g,''));
|
262
|
+
if (isNaN(bb)) bb = 0;
|
263
|
+
return aa-bb;
|
264
|
+
},
|
265
|
+
sort_alpha: function(a,b) {
|
266
|
+
if (a[0]==b[0]) return 0;
|
267
|
+
if (a[0]<b[0]) return -1;
|
268
|
+
return 1;
|
269
|
+
},
|
270
|
+
sort_ddmm: function(a,b) {
|
271
|
+
mtch = a[0].match(sorttable.DATE_RE);
|
272
|
+
y = mtch[3]; m = mtch[2]; d = mtch[1];
|
273
|
+
if (m.length == 1) m = '0'+m;
|
274
|
+
if (d.length == 1) d = '0'+d;
|
275
|
+
dt1 = y+m+d;
|
276
|
+
mtch = b[0].match(sorttable.DATE_RE);
|
277
|
+
y = mtch[3]; m = mtch[2]; d = mtch[1];
|
278
|
+
if (m.length == 1) m = '0'+m;
|
279
|
+
if (d.length == 1) d = '0'+d;
|
280
|
+
dt2 = y+m+d;
|
281
|
+
if (dt1==dt2) return 0;
|
282
|
+
if (dt1<dt2) return -1;
|
283
|
+
return 1;
|
284
|
+
},
|
285
|
+
sort_mmdd: function(a,b) {
|
286
|
+
mtch = a[0].match(sorttable.DATE_RE);
|
287
|
+
y = mtch[3]; d = mtch[2]; m = mtch[1];
|
288
|
+
if (m.length == 1) m = '0'+m;
|
289
|
+
if (d.length == 1) d = '0'+d;
|
290
|
+
dt1 = y+m+d;
|
291
|
+
mtch = b[0].match(sorttable.DATE_RE);
|
292
|
+
y = mtch[3]; d = mtch[2]; m = mtch[1];
|
293
|
+
if (m.length == 1) m = '0'+m;
|
294
|
+
if (d.length == 1) d = '0'+d;
|
295
|
+
dt2 = y+m+d;
|
296
|
+
if (dt1==dt2) return 0;
|
297
|
+
if (dt1<dt2) return -1;
|
298
|
+
return 1;
|
299
|
+
},
|
300
|
+
|
301
|
+
shaker_sort: function(list, comp_func) {
|
302
|
+
// A stable sort function to allow multi-level sorting of data
|
303
|
+
// see: http://en.wikipedia.org/wiki/Cocktail_sort
|
304
|
+
// thanks to Joseph Nahmias
|
305
|
+
var b = 0;
|
306
|
+
var t = list.length - 1;
|
307
|
+
var swap = true;
|
308
|
+
|
309
|
+
while(swap) {
|
310
|
+
swap = false;
|
311
|
+
for(var i = b; i < t; ++i) {
|
312
|
+
if ( comp_func(list[i], list[i+1]) > 0 ) {
|
313
|
+
var q = list[i]; list[i] = list[i+1]; list[i+1] = q;
|
314
|
+
swap = true;
|
315
|
+
}
|
316
|
+
} // for
|
317
|
+
t--;
|
318
|
+
|
319
|
+
if (!swap) break;
|
320
|
+
|
321
|
+
for(var i = t; i > b; --i) {
|
322
|
+
if ( comp_func(list[i], list[i-1]) < 0 ) {
|
323
|
+
var q = list[i]; list[i] = list[i-1]; list[i-1] = q;
|
324
|
+
swap = true;
|
325
|
+
}
|
326
|
+
} // for
|
327
|
+
b++;
|
328
|
+
|
329
|
+
} // while(swap)
|
330
|
+
}
|
331
|
+
}
|
332
|
+
|
333
|
+
/* ******************************************************************
|
334
|
+
Supporting functions: bundled here to avoid depending on a library
|
335
|
+
****************************************************************** */
|
336
|
+
|
337
|
+
// Dean Edwards/Matthias Miller/John Resig
|
338
|
+
|
339
|
+
/* for Mozilla/Opera9 */
|
340
|
+
if (document.addEventListener) {
|
341
|
+
document.addEventListener("DOMContentLoaded", sorttable.init, false);
|
342
|
+
}
|
343
|
+
|
344
|
+
/* for Internet Explorer */
|
345
|
+
/*@cc_on @*/
|
346
|
+
/*@if (@_win32)
|
347
|
+
document.write("<script id=__ie_onload defer src=javascript:void(0)><\/script>");
|
348
|
+
var script = document.getElementById("__ie_onload");
|
349
|
+
script.onreadystatechange = function() {
|
350
|
+
if (this.readyState == "complete") {
|
351
|
+
sorttable.init(); // call the onload handler
|
352
|
+
}
|
353
|
+
};
|
354
|
+
/*@end @*/
|
355
|
+
|
356
|
+
/* for Safari */
|
357
|
+
if (/WebKit/i.test(navigator.userAgent)) { // sniff
|
358
|
+
var _timer = setInterval(function() {
|
359
|
+
if (/loaded|complete/.test(document.readyState)) {
|
360
|
+
sorttable.init(); // call the onload handler
|
361
|
+
}
|
362
|
+
}, 10);
|
363
|
+
}
|
364
|
+
|
365
|
+
/* for other browsers */
|
366
|
+
window.onload = sorttable.init;
|
367
|
+
|
368
|
+
// written by Dean Edwards, 2005
|
369
|
+
// with input from Tino Zijdel, Matthias Miller, Diego Perini
|
370
|
+
|
371
|
+
// http://dean.edwards.name/weblog/2005/10/add-event/
|
372
|
+
|
373
|
+
function dean_addEvent(element, type, handler) {
|
374
|
+
if (element.addEventListener) {
|
375
|
+
element.addEventListener(type, handler, false);
|
376
|
+
} else {
|
377
|
+
// assign each event handler a unique ID
|
378
|
+
if (!handler.$$guid) handler.$$guid = dean_addEvent.guid++;
|
379
|
+
// create a hash table of event types for the element
|
380
|
+
if (!element.events) element.events = {};
|
381
|
+
// create a hash table of event handlers for each element/event pair
|
382
|
+
var handlers = element.events[type];
|
383
|
+
if (!handlers) {
|
384
|
+
handlers = element.events[type] = {};
|
385
|
+
// store the existing event handler (if there is one)
|
386
|
+
if (element["on" + type]) {
|
387
|
+
handlers[0] = element["on" + type];
|
388
|
+
}
|
389
|
+
}
|
390
|
+
// store the event handler in the hash table
|
391
|
+
handlers[handler.$$guid] = handler;
|
392
|
+
// assign a global event handler to do all the work
|
393
|
+
element["on" + type] = handleEvent;
|
394
|
+
}
|
395
|
+
};
|
396
|
+
// a counter used to create unique IDs
|
397
|
+
dean_addEvent.guid = 1;
|
398
|
+
|
399
|
+
function removeEvent(element, type, handler) {
|
400
|
+
if (element.removeEventListener) {
|
401
|
+
element.removeEventListener(type, handler, false);
|
402
|
+
} else {
|
403
|
+
// delete the event handler from the hash table
|
404
|
+
if (element.events && element.events[type]) {
|
405
|
+
delete element.events[type][handler.$$guid];
|
406
|
+
}
|
407
|
+
}
|
408
|
+
};
|
409
|
+
|
410
|
+
function handleEvent(event) {
|
411
|
+
var returnValue = true;
|
412
|
+
// grab the event object (IE uses a global event object)
|
413
|
+
event = event || fixEvent(((this.ownerDocument || this.document || this).parentWindow || window).event);
|
414
|
+
// get a reference to the hash table of event handlers
|
415
|
+
var handlers = this.events[event.type];
|
416
|
+
// execute each event handler
|
417
|
+
for (var i in handlers) {
|
418
|
+
this.$$handleEvent = handlers[i];
|
419
|
+
if (this.$$handleEvent(event) === false) {
|
420
|
+
returnValue = false;
|
421
|
+
}
|
422
|
+
}
|
423
|
+
return returnValue;
|
424
|
+
};
|
425
|
+
|
426
|
+
function fixEvent(event) {
|
427
|
+
// add W3C standard event methods
|
428
|
+
event.preventDefault = fixEvent.preventDefault;
|
429
|
+
event.stopPropagation = fixEvent.stopPropagation;
|
430
|
+
return event;
|
431
|
+
};
|
432
|
+
fixEvent.preventDefault = function() {
|
433
|
+
this.returnValue = false;
|
434
|
+
};
|
435
|
+
fixEvent.stopPropagation = function() {
|
436
|
+
this.cancelBubble = true;
|
437
|
+
}
|
438
|
+
|
439
|
+
// Dean's forEach: http://dean.edwards.name/base/forEach.js
|
440
|
+
/*
|
441
|
+
forEach, version 1.0
|
442
|
+
Copyright 2006, Dean Edwards
|
443
|
+
License: http://www.opensource.org/licenses/mit-license.php
|
444
|
+
*/
|
445
|
+
|
446
|
+
// array-like enumeration
|
447
|
+
if (!Array.forEach) { // mozilla already supports this
|
448
|
+
Array.forEach = function(array, block, context) {
|
449
|
+
for (var i = 0; i < array.length; i++) {
|
450
|
+
block.call(context, array[i], i, array);
|
451
|
+
}
|
452
|
+
};
|
453
|
+
}
|
454
|
+
|
455
|
+
// generic enumeration
|
456
|
+
Function.prototype.forEach = function(object, block, context) {
|
457
|
+
for (var key in object) {
|
458
|
+
if (typeof this.prototype[key] == "undefined") {
|
459
|
+
block.call(context, object[key], key, object);
|
460
|
+
}
|
461
|
+
}
|
462
|
+
};
|
463
|
+
|
464
|
+
// character enumeration
|
465
|
+
String.forEach = function(string, block, context) {
|
466
|
+
Array.forEach(string.split(""), function(chr, index) {
|
467
|
+
block.call(context, chr, index, string);
|
468
|
+
});
|
469
|
+
};
|
470
|
+
|
471
|
+
// globally resolve forEach enumeration
|
472
|
+
var forEach = function(object, block, context) {
|
473
|
+
if (object) {
|
474
|
+
var resolve = Object; // default
|
475
|
+
if (object instanceof Function) {
|
476
|
+
// functions have a "length" property
|
477
|
+
resolve = Function;
|
478
|
+
} else if (object.forEach instanceof Function) {
|
479
|
+
// the object implements a custom forEach method so use that
|
480
|
+
object.forEach(block, context);
|
481
|
+
return;
|
482
|
+
} else if (typeof object == "string") {
|
483
|
+
// the object is a string
|
484
|
+
resolve = String;
|
485
|
+
} else if (typeof object.length == "number") {
|
486
|
+
// the object is array-like
|
487
|
+
resolve = Array;
|
488
|
+
}
|
489
|
+
resolve.forEach(object, block, context);
|
490
|
+
}
|
491
|
+
};
|
492
|
+
|
@@ -0,0 +1,34 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
2
|
+
<html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
|
3
|
+
<head>
|
4
|
+
<meta content='text/html; charset=utf-8' http-equiv='Content-Type' />
|
5
|
+
<meta content='en' http-equiv='Content-Language' />
|
6
|
+
<title>metrics</title>
|
7
|
+
<style>
|
8
|
+
<%= inline_css("css/reset.css") %>
|
9
|
+
<%= inline_css("css/buttons.css") %>
|
10
|
+
<%= inline_css("css/integrity.css") %>
|
11
|
+
<%= inline_css("css/default.css") %>
|
12
|
+
</style>
|
13
|
+
|
14
|
+
|
15
|
+
<script type="text/javascript" language="javascript">
|
16
|
+
//<![CDATA[
|
17
|
+
<%= inline_css("js/sorttable.js") %>
|
18
|
+
//]]>
|
19
|
+
</script>
|
20
|
+
<link REL="SHORTCUT ICON" HREF="/favicon.ico">
|
21
|
+
</head>
|
22
|
+
<body>
|
23
|
+
<div id='header'>
|
24
|
+
<h1><a href="/">metrics</a> | <a href="index.html"><%= @name %></a></h1>
|
25
|
+
<address class='watermark'>
|
26
|
+
built with
|
27
|
+
<a href='http://metric-fu.rubyforge.org/'>metric-fu</a>
|
28
|
+
</address>
|
29
|
+
</div>
|
30
|
+
<div id='content'>
|
31
|
+
<%= @html %>
|
32
|
+
</div>
|
33
|
+
</body>
|
34
|
+
</html>
|
@@ -0,0 +1,36 @@
|
|
1
|
+
<h3>Rcov Code Coverage Results</h3>
|
2
|
+
|
3
|
+
<p>C0 code coverage information.</p>
|
4
|
+
|
5
|
+
<img src="rcov.png?<%= Time.now %>">
|
6
|
+
|
7
|
+
<p>Total Coverage: <%= @rcov.delete(:global_percent_run) %>% </p>
|
8
|
+
<table class="sortable">
|
9
|
+
<tr>
|
10
|
+
<th>File Path</th>
|
11
|
+
<th>Percent run</th>
|
12
|
+
</tr>
|
13
|
+
<% count = 0 %>
|
14
|
+
<% @rcov.sort_by{ |k,v| v[:percent_run] }.each do |fname, file| %>
|
15
|
+
<tr>
|
16
|
+
<td><a href="#<%= fname.gsub(/[^a-z]+/, '_') %>"><%= fname %></a></td>
|
17
|
+
<td><%= file[:percent_run] %></td>
|
18
|
+
</tr>
|
19
|
+
<% count += 1 %>
|
20
|
+
<% end %>
|
21
|
+
</table>
|
22
|
+
|
23
|
+
<% @rcov.sort_by{ |k,v| v[:percent_run] }.each do |fname, file| %>
|
24
|
+
<h2 id="<%= fname.gsub(/[^a-z]+/, '_') %>"> <%= fname %></h2>
|
25
|
+
<div class="rcov_overflow">
|
26
|
+
<table class="rcov_code">
|
27
|
+
<% file[:lines].each_with_index do |line, index| %>
|
28
|
+
<tr>
|
29
|
+
<% css_class = line[:was_run] ? "rcov_run" : "rcov_not_run" %>
|
30
|
+
<td class="<%= css_class %>"><%= link_to_filename(fname, index + 1, "<pre>#{line[:content]}</pre>") %></td>
|
31
|
+
</tr>
|
32
|
+
<% end %>
|
33
|
+
</table>
|
34
|
+
</div>
|
35
|
+
<% end %>
|
36
|
+
<p>Generated on <%= Time.now.localtime %></p>
|
@@ -0,0 +1,34 @@
|
|
1
|
+
<h3>Reek Results</h3>
|
2
|
+
|
3
|
+
<p><a href="http://reek.rubyforge.org/">Reek</a> detects common code smells in ruby code.</p>
|
4
|
+
|
5
|
+
<img src="reek.png?<%= Time.now %>">
|
6
|
+
|
7
|
+
<table class="sortable">
|
8
|
+
<tr>
|
9
|
+
<th>File Path</th>
|
10
|
+
<th>Method</th>
|
11
|
+
<th>Description</th>
|
12
|
+
<th>Type</th>
|
13
|
+
</tr>
|
14
|
+
<% count = 0 %>
|
15
|
+
<% @reek[:matches].each do |match| %>
|
16
|
+
<% match[:code_smells].each do |smell| %>
|
17
|
+
<tr class='<%= cycle("light", "dark", count) %>'>
|
18
|
+
<td><%= link_to_filename(match[:file_path]) %></td>
|
19
|
+
<td>
|
20
|
+
<%= smell[:method] %>
|
21
|
+
</td>
|
22
|
+
<td>
|
23
|
+
<%= smell[:message] %>
|
24
|
+
</td>
|
25
|
+
<td>
|
26
|
+
<%= smell[:type] %>
|
27
|
+
</td>
|
28
|
+
</tr>
|
29
|
+
<% count += 1 %>
|
30
|
+
<% end %>
|
31
|
+
<% end %>
|
32
|
+
|
33
|
+
</table>
|
34
|
+
<p>Generated on <%= Time.now.localtime %></p>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<h3>Roodi Results</h3>
|
2
|
+
|
3
|
+
<p><a href="http://roodi.rubyforge.org/">Roodi</a> parses your Ruby code and warns you about design issues you have based on the checks that is has configured.</p>
|
4
|
+
|
5
|
+
<img src="roodi.png?<%= Time.now %>">
|
6
|
+
|
7
|
+
<table class="sortable">
|
8
|
+
<tr>
|
9
|
+
<th>File Path</th>
|
10
|
+
<th>Warning</th>
|
11
|
+
</tr>
|
12
|
+
<% count = 0 %>
|
13
|
+
<% @roodi[:problems].each do |problem| %>
|
14
|
+
<tr class='<%= cycle("light", "dark", count) %>'>
|
15
|
+
<td><%= link_to_filename(problem[:file], problem[:line]) %></td>
|
16
|
+
<td><%= problem[:problem] %></td>
|
17
|
+
</tr>
|
18
|
+
<% count += 1 %>
|
19
|
+
<% end %>
|
20
|
+
</table>
|
21
|
+
<p>Generated on <%= Time.now.localtime %></p>
|
@@ -0,0 +1,71 @@
|
|
1
|
+
<h3>Saikuro Results</h3>
|
2
|
+
<p><a href='http://saikuro.rubyforge.org/'>Saikuro</a> analyzes ruby code for cyclomatic complexity.</p>
|
3
|
+
|
4
|
+
<h2>Analyzed Methods</h2>
|
5
|
+
<table class="sortable">
|
6
|
+
<tr>
|
7
|
+
<th>Method Name</th>
|
8
|
+
<th>Complexity</th>
|
9
|
+
<th># Lines</th>
|
10
|
+
</tr>
|
11
|
+
<% @saikuro[:methods].each do |method| %>
|
12
|
+
<tr>
|
13
|
+
<td><%= method[:name] %></td>
|
14
|
+
<td><%= method[:complexity] %></td>
|
15
|
+
<td><%= method[:lines] %></td>
|
16
|
+
</tr>
|
17
|
+
<% end %>
|
18
|
+
</table>
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
<h2>Analyzed Classes</h2>
|
23
|
+
<table class="sortable">
|
24
|
+
<tr>
|
25
|
+
<th>Class Name</th>
|
26
|
+
<th>Complexity</th>
|
27
|
+
<th># Lines</th>
|
28
|
+
</tr>
|
29
|
+
<% @saikuro[:classes].each do |klass| %>
|
30
|
+
<tr>
|
31
|
+
<td><%= klass[:name] %></td>
|
32
|
+
<td><%= klass[:complexity] %></td>
|
33
|
+
<td><%= klass[:lines] %></td>
|
34
|
+
</tr>
|
35
|
+
<% end %>
|
36
|
+
</table>
|
37
|
+
|
38
|
+
|
39
|
+
<h2>Analyzed Files</h2>
|
40
|
+
<% @saikuro[:files].each do |file| %>
|
41
|
+
<% file[:classes].each do |klass| %>
|
42
|
+
<% if !klass[:methods].empty? %>
|
43
|
+
<h3><%= file[:filename] %></h3>
|
44
|
+
<h4>Class : <%= klass[:class_name] %></h4>
|
45
|
+
<h5>Total complexity : <%= klass[:complexity] %></h5>
|
46
|
+
<h5>Total lines : <%= klass[:lines] %></h5>
|
47
|
+
<table class="sortable">
|
48
|
+
<tr>
|
49
|
+
<th>Method</th>
|
50
|
+
<th>Complexity</th>
|
51
|
+
<th># Lines</th>
|
52
|
+
</tr>
|
53
|
+
<% klass[:methods].each do |method| %>
|
54
|
+
<tr>
|
55
|
+
<td>
|
56
|
+
<%= method[:name] %>
|
57
|
+
</td>
|
58
|
+
<td>
|
59
|
+
<%= method[:complexity] %>
|
60
|
+
</td>
|
61
|
+
<td>
|
62
|
+
<%= method[:lines] %>
|
63
|
+
</td>
|
64
|
+
</tr>
|
65
|
+
<% end %>
|
66
|
+
</table>
|
67
|
+
<% end %>
|
68
|
+
<% end %>
|
69
|
+
<% end %>
|
70
|
+
|
71
|
+
<p>Generated on <%= Time.now.localtime %></p>
|