code_stats2 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/code_stats +4 -4
- data/lib/code_stats/languages.rb +8 -0
- data/lib/code_stats/report.html.haml +19 -19
- data/lib/code_stats/report/highchart.js +1976 -1976
- data/lib/code_stats/report/jquery.js +53 -53
- data/lib/code_stats/report/report.js +6 -6
- data/spec/languages_spec.rb +18 -4
- metadata +10 -10
@@ -1895,11 +1895,11 @@ jQuery.fn.extend({
|
|
1895
1895
|
jQuery.removeAttr( this, name );
|
1896
1896
|
});
|
1897
1897
|
},
|
1898
|
-
|
1898
|
+
|
1899
1899
|
prop: function( name, value ) {
|
1900
1900
|
return jQuery.access( this, name, value, true, jQuery.prop );
|
1901
1901
|
},
|
1902
|
-
|
1902
|
+
|
1903
1903
|
removeProp: function( name ) {
|
1904
1904
|
name = jQuery.propFix[ name ] || name;
|
1905
1905
|
return this.each(function() {
|
@@ -2031,7 +2031,7 @@ jQuery.fn.extend({
|
|
2031
2031
|
val: function( value ) {
|
2032
2032
|
var hooks, ret,
|
2033
2033
|
elem = this[0];
|
2034
|
-
|
2034
|
+
|
2035
2035
|
if ( !arguments.length ) {
|
2036
2036
|
if ( elem ) {
|
2037
2037
|
hooks = jQuery.valHooks[ elem.nodeName.toLowerCase() ] || jQuery.valHooks[ elem.type ];
|
@@ -2159,15 +2159,15 @@ jQuery.extend({
|
|
2159
2159
|
height: true,
|
2160
2160
|
offset: true
|
2161
2161
|
},
|
2162
|
-
|
2162
|
+
|
2163
2163
|
attrFix: {
|
2164
2164
|
// Always normalize to ensure hook usage
|
2165
2165
|
tabindex: "tabIndex"
|
2166
2166
|
},
|
2167
|
-
|
2167
|
+
|
2168
2168
|
attr: function( elem, name, value, pass ) {
|
2169
2169
|
var nType = elem.nodeType;
|
2170
|
-
|
2170
|
+
|
2171
2171
|
// don't get/set attributes on text, comment and attribute nodes
|
2172
2172
|
if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
|
2173
2173
|
return undefined;
|
@@ -2235,7 +2235,7 @@ jQuery.extend({
|
|
2235
2235
|
var propName;
|
2236
2236
|
if ( elem.nodeType === 1 ) {
|
2237
2237
|
name = jQuery.attrFix[ name ] || name;
|
2238
|
-
|
2238
|
+
|
2239
2239
|
if ( jQuery.support.getSetAttribute ) {
|
2240
2240
|
// Use removeAttribute in browsers that support it
|
2241
2241
|
elem.removeAttribute( name );
|
@@ -2299,7 +2299,7 @@ jQuery.extend({
|
|
2299
2299
|
frameborder: "frameBorder",
|
2300
2300
|
contenteditable: "contentEditable"
|
2301
2301
|
},
|
2302
|
-
|
2302
|
+
|
2303
2303
|
prop: function( elem, name, value ) {
|
2304
2304
|
var nType = elem.nodeType;
|
2305
2305
|
|
@@ -2313,7 +2313,7 @@ jQuery.extend({
|
|
2313
2313
|
|
2314
2314
|
// Try to normalize/fix the name
|
2315
2315
|
name = notxml && jQuery.propFix[ name ] || name;
|
2316
|
-
|
2316
|
+
|
2317
2317
|
hooks = jQuery.propHooks[ name ];
|
2318
2318
|
|
2319
2319
|
if ( value !== undefined ) {
|
@@ -2333,7 +2333,7 @@ jQuery.extend({
|
|
2333
2333
|
}
|
2334
2334
|
}
|
2335
2335
|
},
|
2336
|
-
|
2336
|
+
|
2337
2337
|
propHooks: {}
|
2338
2338
|
});
|
2339
2339
|
|
@@ -2388,7 +2388,7 @@ if ( !jQuery.support.getSetAttribute ) {
|
|
2388
2388
|
|
2389
2389
|
// propFix is more comprehensive and contains all fixes
|
2390
2390
|
jQuery.attrFix = jQuery.propFix;
|
2391
|
-
|
2391
|
+
|
2392
2392
|
// Use this for any attribute on a form in IE6/7
|
2393
2393
|
formHook = jQuery.attrHooks.name = jQuery.valHooks.button = {
|
2394
2394
|
get: function( elem, name ) {
|
@@ -2759,7 +2759,7 @@ jQuery.event = {
|
|
2759
2759
|
}
|
2760
2760
|
}
|
2761
2761
|
},
|
2762
|
-
|
2762
|
+
|
2763
2763
|
// Events that are safe to short-circuit if no handlers are attached.
|
2764
2764
|
// Native DOM events should not be added, they may have inline handlers.
|
2765
2765
|
customEvent: {
|
@@ -2805,7 +2805,7 @@ jQuery.event = {
|
|
2805
2805
|
event.exclusive = exclusive;
|
2806
2806
|
event.namespace = namespaces.join(".");
|
2807
2807
|
event.namespace_re = new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)");
|
2808
|
-
|
2808
|
+
|
2809
2809
|
// triggerHandler() and global events don't bubble or run the default action
|
2810
2810
|
if ( onlyHandlers || !elem ) {
|
2811
2811
|
event.preventDefault();
|
@@ -2896,7 +2896,7 @@ jQuery.event = {
|
|
2896
2896
|
jQuery.event.triggered = undefined;
|
2897
2897
|
}
|
2898
2898
|
}
|
2899
|
-
|
2899
|
+
|
2900
2900
|
return event.result;
|
2901
2901
|
},
|
2902
2902
|
|
@@ -3731,7 +3731,7 @@ var Sizzle = function( selector, context, results, seed ) {
|
|
3731
3731
|
if ( context.nodeType !== 1 && context.nodeType !== 9 ) {
|
3732
3732
|
return [];
|
3733
3733
|
}
|
3734
|
-
|
3734
|
+
|
3735
3735
|
if ( !selector || typeof selector !== "string" ) {
|
3736
3736
|
return results;
|
3737
3737
|
}
|
@@ -3741,7 +3741,7 @@ var Sizzle = function( selector, context, results, seed ) {
|
|
3741
3741
|
contextXML = Sizzle.isXML( context ),
|
3742
3742
|
parts = [],
|
3743
3743
|
soFar = selector;
|
3744
|
-
|
3744
|
+
|
3745
3745
|
// Reset the position of the chunker regexp (start from head)
|
3746
3746
|
do {
|
3747
3747
|
chunker.exec( "" );
|
@@ -3749,9 +3749,9 @@ var Sizzle = function( selector, context, results, seed ) {
|
|
3749
3749
|
|
3750
3750
|
if ( m ) {
|
3751
3751
|
soFar = m[3];
|
3752
|
-
|
3752
|
+
|
3753
3753
|
parts.push( m[1] );
|
3754
|
-
|
3754
|
+
|
3755
3755
|
if ( m[2] ) {
|
3756
3756
|
extra = m[3];
|
3757
3757
|
break;
|
@@ -3775,7 +3775,7 @@ var Sizzle = function( selector, context, results, seed ) {
|
|
3775
3775
|
if ( Expr.relative[ selector ] ) {
|
3776
3776
|
selector += parts.shift();
|
3777
3777
|
}
|
3778
|
-
|
3778
|
+
|
3779
3779
|
set = posProcess( selector, set );
|
3780
3780
|
}
|
3781
3781
|
}
|
@@ -3904,7 +3904,7 @@ Sizzle.find = function( expr, context, isXML ) {
|
|
3904
3904
|
for ( var i = 0, l = Expr.order.length; i < l; i++ ) {
|
3905
3905
|
var match,
|
3906
3906
|
type = Expr.order[i];
|
3907
|
-
|
3907
|
+
|
3908
3908
|
if ( (match = Expr.leftMatch[ type ].exec( expr )) ) {
|
3909
3909
|
var left = match[1];
|
3910
3910
|
match.splice( 1, 1 );
|
@@ -4236,7 +4236,7 @@ var Expr = Sizzle.selectors = {
|
|
4236
4236
|
|
4237
4237
|
ATTR: function( match, curLoop, inplace, result, not, isXML ) {
|
4238
4238
|
var name = match[1] = match[1].replace( rBackslash, "" );
|
4239
|
-
|
4239
|
+
|
4240
4240
|
if ( !isXML && Expr.attrMap[name] ) {
|
4241
4241
|
match[1] = Expr.attrMap[name];
|
4242
4242
|
}
|
@@ -4270,7 +4270,7 @@ var Expr = Sizzle.selectors = {
|
|
4270
4270
|
} else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {
|
4271
4271
|
return true;
|
4272
4272
|
}
|
4273
|
-
|
4273
|
+
|
4274
4274
|
return match;
|
4275
4275
|
},
|
4276
4276
|
|
@@ -4280,7 +4280,7 @@ var Expr = Sizzle.selectors = {
|
|
4280
4280
|
return match;
|
4281
4281
|
}
|
4282
4282
|
},
|
4283
|
-
|
4283
|
+
|
4284
4284
|
filters: {
|
4285
4285
|
enabled: function( elem ) {
|
4286
4286
|
return elem.disabled === false && elem.type !== "hidden";
|
@@ -4293,14 +4293,14 @@ var Expr = Sizzle.selectors = {
|
|
4293
4293
|
checked: function( elem ) {
|
4294
4294
|
return elem.checked === true;
|
4295
4295
|
},
|
4296
|
-
|
4296
|
+
|
4297
4297
|
selected: function( elem ) {
|
4298
4298
|
// Accessing this property makes selected-by-default
|
4299
4299
|
// options in Safari work properly
|
4300
4300
|
if ( elem.parentNode ) {
|
4301
4301
|
elem.parentNode.selectedIndex;
|
4302
4302
|
}
|
4303
|
-
|
4303
|
+
|
4304
4304
|
return elem.selected === true;
|
4305
4305
|
},
|
4306
4306
|
|
@@ -4322,7 +4322,7 @@ var Expr = Sizzle.selectors = {
|
|
4322
4322
|
|
4323
4323
|
text: function( elem ) {
|
4324
4324
|
var attr = elem.getAttribute( "type" ), type = elem.type;
|
4325
|
-
// IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
|
4325
|
+
// IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
|
4326
4326
|
// use getAttribute instead to test this case
|
4327
4327
|
return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null );
|
4328
4328
|
},
|
@@ -4438,21 +4438,21 @@ var Expr = Sizzle.selectors = {
|
|
4438
4438
|
case "only":
|
4439
4439
|
case "first":
|
4440
4440
|
while ( (node = node.previousSibling) ) {
|
4441
|
-
if ( node.nodeType === 1 ) {
|
4442
|
-
return false;
|
4441
|
+
if ( node.nodeType === 1 ) {
|
4442
|
+
return false;
|
4443
4443
|
}
|
4444
4444
|
}
|
4445
4445
|
|
4446
|
-
if ( type === "first" ) {
|
4447
|
-
return true;
|
4446
|
+
if ( type === "first" ) {
|
4447
|
+
return true;
|
4448
4448
|
}
|
4449
4449
|
|
4450
4450
|
node = elem;
|
4451
4451
|
|
4452
4452
|
case "last":
|
4453
4453
|
while ( (node = node.nextSibling) ) {
|
4454
|
-
if ( node.nodeType === 1 ) {
|
4455
|
-
return false;
|
4454
|
+
if ( node.nodeType === 1 ) {
|
4455
|
+
return false;
|
4456
4456
|
}
|
4457
4457
|
}
|
4458
4458
|
|
@@ -4465,22 +4465,22 @@ var Expr = Sizzle.selectors = {
|
|
4465
4465
|
if ( first === 1 && last === 0 ) {
|
4466
4466
|
return true;
|
4467
4467
|
}
|
4468
|
-
|
4468
|
+
|
4469
4469
|
var doneName = match[0],
|
4470
4470
|
parent = elem.parentNode;
|
4471
|
-
|
4471
|
+
|
4472
4472
|
if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) {
|
4473
4473
|
var count = 0;
|
4474
|
-
|
4474
|
+
|
4475
4475
|
for ( node = parent.firstChild; node; node = node.nextSibling ) {
|
4476
4476
|
if ( node.nodeType === 1 ) {
|
4477
4477
|
node.nodeIndex = ++count;
|
4478
4478
|
}
|
4479
|
-
}
|
4479
|
+
}
|
4480
4480
|
|
4481
4481
|
parent.sizcache = doneName;
|
4482
4482
|
}
|
4483
|
-
|
4483
|
+
|
4484
4484
|
var diff = elem.nodeIndex - last;
|
4485
4485
|
|
4486
4486
|
if ( first === 0 ) {
|
@@ -4499,7 +4499,7 @@ var Expr = Sizzle.selectors = {
|
|
4499
4499
|
TAG: function( elem, match ) {
|
4500
4500
|
return (match === "*" && elem.nodeType === 1) || elem.nodeName.toLowerCase() === match;
|
4501
4501
|
},
|
4502
|
-
|
4502
|
+
|
4503
4503
|
CLASS: function( elem, match ) {
|
4504
4504
|
return (" " + (elem.className || elem.getAttribute("class")) + " ")
|
4505
4505
|
.indexOf( match ) > -1;
|
@@ -4565,7 +4565,7 @@ var makeArray = function( array, results ) {
|
|
4565
4565
|
results.push.apply( results, array );
|
4566
4566
|
return results;
|
4567
4567
|
}
|
4568
|
-
|
4568
|
+
|
4569
4569
|
return array;
|
4570
4570
|
};
|
4571
4571
|
|
@@ -4817,7 +4817,7 @@ if ( document.querySelectorAll ) {
|
|
4817
4817
|
if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {
|
4818
4818
|
return;
|
4819
4819
|
}
|
4820
|
-
|
4820
|
+
|
4821
4821
|
Sizzle = function( query, context, extra, seed ) {
|
4822
4822
|
context = context || document;
|
4823
4823
|
|
@@ -4826,24 +4826,24 @@ if ( document.querySelectorAll ) {
|
|
4826
4826
|
if ( !seed && !Sizzle.isXML(context) ) {
|
4827
4827
|
// See if we find a selector to speed up
|
4828
4828
|
var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query );
|
4829
|
-
|
4829
|
+
|
4830
4830
|
if ( match && (context.nodeType === 1 || context.nodeType === 9) ) {
|
4831
4831
|
// Speed-up: Sizzle("TAG")
|
4832
4832
|
if ( match[1] ) {
|
4833
4833
|
return makeArray( context.getElementsByTagName( query ), extra );
|
4834
|
-
|
4834
|
+
|
4835
4835
|
// Speed-up: Sizzle(".CLASS")
|
4836
4836
|
} else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) {
|
4837
4837
|
return makeArray( context.getElementsByClassName( match[2] ), extra );
|
4838
4838
|
}
|
4839
4839
|
}
|
4840
|
-
|
4840
|
+
|
4841
4841
|
if ( context.nodeType === 9 ) {
|
4842
4842
|
// Speed-up: Sizzle("body")
|
4843
4843
|
// The body element only exists once, optimize finding it
|
4844
4844
|
if ( query === "body" && context.body ) {
|
4845
4845
|
return makeArray( [ context.body ], extra );
|
4846
|
-
|
4846
|
+
|
4847
4847
|
// Speed-up: Sizzle("#ID")
|
4848
4848
|
} else if ( match && match[3] ) {
|
4849
4849
|
var elem = context.getElementById( match[3] );
|
@@ -4856,12 +4856,12 @@ if ( document.querySelectorAll ) {
|
|
4856
4856
|
if ( elem.id === match[3] ) {
|
4857
4857
|
return makeArray( [ elem ], extra );
|
4858
4858
|
}
|
4859
|
-
|
4859
|
+
|
4860
4860
|
} else {
|
4861
4861
|
return makeArray( [], extra );
|
4862
4862
|
}
|
4863
4863
|
}
|
4864
|
-
|
4864
|
+
|
4865
4865
|
try {
|
4866
4866
|
return makeArray( context.querySelectorAll(query), extra );
|
4867
4867
|
} catch(qsaError) {}
|
@@ -4899,7 +4899,7 @@ if ( document.querySelectorAll ) {
|
|
4899
4899
|
}
|
4900
4900
|
}
|
4901
4901
|
}
|
4902
|
-
|
4902
|
+
|
4903
4903
|
return oldSizzle(query, context, extra, seed);
|
4904
4904
|
};
|
4905
4905
|
|
@@ -4926,7 +4926,7 @@ if ( document.querySelectorAll ) {
|
|
4926
4926
|
// This should fail with an exception
|
4927
4927
|
// Gecko does not error, returns false instead
|
4928
4928
|
matches.call( document.documentElement, "[test!='']:sizzle" );
|
4929
|
-
|
4929
|
+
|
4930
4930
|
} catch( pseudoError ) {
|
4931
4931
|
pseudoWorks = true;
|
4932
4932
|
}
|
@@ -4936,7 +4936,7 @@ if ( document.querySelectorAll ) {
|
|
4936
4936
|
expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");
|
4937
4937
|
|
4938
4938
|
if ( !Sizzle.isXML( node ) ) {
|
4939
|
-
try {
|
4939
|
+
try {
|
4940
4940
|
if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) {
|
4941
4941
|
var ret = matches.call( node, expr );
|
4942
4942
|
|
@@ -4973,7 +4973,7 @@ if ( document.querySelectorAll ) {
|
|
4973
4973
|
if ( div.getElementsByClassName("e").length === 1 ) {
|
4974
4974
|
return;
|
4975
4975
|
}
|
4976
|
-
|
4976
|
+
|
4977
4977
|
Expr.order.splice(1, 0, "CLASS");
|
4978
4978
|
Expr.find.CLASS = function( match, context, isXML ) {
|
4979
4979
|
if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {
|
@@ -5024,7 +5024,7 @@ function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
|
|
5024
5024
|
|
5025
5025
|
if ( elem ) {
|
5026
5026
|
var match = false;
|
5027
|
-
|
5027
|
+
|
5028
5028
|
elem = elem[dir];
|
5029
5029
|
|
5030
5030
|
while ( elem ) {
|
@@ -5077,7 +5077,7 @@ if ( document.documentElement.contains ) {
|
|
5077
5077
|
|
5078
5078
|
Sizzle.isXML = function( elem ) {
|
5079
5079
|
// documentElement is verified for cases where it doesn't yet exist
|
5080
|
-
// (such as loading iframes in IE - #4833)
|
5080
|
+
// (such as loading iframes in IE - #4833)
|
5081
5081
|
var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement;
|
5082
5082
|
|
5083
5083
|
return documentElement ? documentElement.nodeName !== "HTML" : false;
|
@@ -5198,7 +5198,7 @@ jQuery.fn.extend({
|
|
5198
5198
|
|
5199
5199
|
closest: function( selectors, context ) {
|
5200
5200
|
var ret = [], i, l, cur = this[0];
|
5201
|
-
|
5201
|
+
|
5202
5202
|
// Array
|
5203
5203
|
if ( jQuery.isArray( selectors ) ) {
|
5204
5204
|
var match, selector,
|
@@ -1,5 +1,5 @@
|
|
1
1
|
var Report = {};
|
2
|
-
Report.plot = function(selector, projects){
|
2
|
+
Report.plot = function(selector, projects){
|
3
3
|
var sources = [], specs = [], labels = [];
|
4
4
|
for(var i = 0; i < projects.length; i++){
|
5
5
|
var project = projects[i];
|
@@ -7,7 +7,7 @@ Report.plot = function(selector, projects){
|
|
7
7
|
sources.push(project[1]);
|
8
8
|
specs.push(project[2]);
|
9
9
|
}
|
10
|
-
|
10
|
+
|
11
11
|
var chart = new Highcharts.Chart({
|
12
12
|
chart: {
|
13
13
|
renderTo: 'plot',
|
@@ -19,7 +19,7 @@ Report.plot = function(selector, projects){
|
|
19
19
|
xAxis: {
|
20
20
|
categories: labels,
|
21
21
|
labels: {
|
22
|
-
rotation: -45,
|
22
|
+
rotation: -45,
|
23
23
|
align: 'right'
|
24
24
|
}
|
25
25
|
},
|
@@ -62,11 +62,11 @@ Report.plot = function(selector, projects){
|
|
62
62
|
color: (Highcharts.theme && Highcharts.theme.dataLabelsColor) || 'white'
|
63
63
|
}
|
64
64
|
}
|
65
|
-
},
|
65
|
+
},
|
66
66
|
series: [{
|
67
67
|
name: 'Specs',
|
68
|
-
data: specs
|
69
|
-
}, {
|
68
|
+
data: specs
|
69
|
+
}, {
|
70
70
|
name: 'Sources',
|
71
71
|
data: sources
|
72
72
|
}]
|
data/spec/languages_spec.rb
CHANGED
@@ -5,7 +5,7 @@ shared_examples_for 'language' do
|
|
5
5
|
lang = CodeStats.parse @script, @extension
|
6
6
|
lang.code.should == <<-CODE
|
7
7
|
code_a
|
8
|
-
code_b
|
8
|
+
code_b
|
9
9
|
CODE
|
10
10
|
# lang.code.should_not include 'comment_a'
|
11
11
|
# lang.code.should_not include 'comment_a2'
|
@@ -157,7 +157,7 @@ describe "Haml" do
|
|
157
157
|
code_a
|
158
158
|
/ comment_a
|
159
159
|
/ comment_a2
|
160
|
-
code_b
|
160
|
+
code_b
|
161
161
|
HAML
|
162
162
|
end
|
163
163
|
end
|
@@ -169,7 +169,7 @@ describe "Erb" do
|
|
169
169
|
@extension = :erb
|
170
170
|
@script = <<-ERB
|
171
171
|
code_a
|
172
|
-
code_b
|
172
|
+
code_b
|
173
173
|
ERB
|
174
174
|
end
|
175
175
|
end
|
@@ -181,7 +181,7 @@ describe "Rjs" do
|
|
181
181
|
@extension = :rjs
|
182
182
|
@script = <<-RJS
|
183
183
|
code_a
|
184
|
-
code_b
|
184
|
+
code_b
|
185
185
|
RJS
|
186
186
|
end
|
187
187
|
end
|
@@ -218,4 +218,18 @@ code_a
|
|
218
218
|
code_b # comment_b3
|
219
219
|
PYTHON
|
220
220
|
end
|
221
|
+
end
|
222
|
+
|
223
|
+
describe "Clojure" do
|
224
|
+
it_should_behave_like "language"
|
225
|
+
|
226
|
+
before do
|
227
|
+
@extension = :clj
|
228
|
+
@script = <<-CLOJURE
|
229
|
+
code_a
|
230
|
+
; comment_a
|
231
|
+
; comment_a2
|
232
|
+
code_b ; comment_b3
|
233
|
+
CLOJURE
|
234
|
+
end
|
221
235
|
end
|