Permalink
Browse files

Fixing some lint issues

  • Loading branch information...
1 parent 9c01611 commit b353bfb77897c6b56071fb348daa93c0bc5d0541 @davglass committed Apr 11, 2013
Showing with 27 additions and 17 deletions.
  1. +20 −14 lib/coverage.js
  2. +3 −1 lib/index.js
  3. +4 −2 lib/wrapper/wrapper.js
View
@@ -50,8 +50,10 @@ var set = function(json) {
var d = {}, i;
for (i in json) {
- d[i] = json[i];
- delete d[i].code;
+ if (json.hasOwnProperty(i)) {
+ d[i] = json[i];
+ delete d[i].code;
+ }
}
if (isIstanbul(json)) {
@@ -61,15 +63,17 @@ var set = function(json) {
coverageInfo.push(json);
} else {
for (i in json) {
- coverageInfo[i] = coverageInfo[i] || {};
- coverageInfo[i].path = i;
- coverageInfo[i].lines = json[i].lines;
- coverageInfo[i].functions = json[i].functions;
- /*jshint loopfunc: true */
- ['calledLines', 'calledFunctions', 'coveredLines', 'coveredFunctions'].forEach(function(prop) {
- coverageInfo[i][prop] = coverageInfo[i][prop] || 0;
- coverageInfo[i][prop] = Math.max(coverageInfo[i][prop], json[i][prop], 0);
- });
+ if (json.hasOwnProperty(i)) {
+ coverageInfo[i] = coverageInfo[i] || {};
+ coverageInfo[i].path = i;
+ coverageInfo[i].lines = json[i].lines;
+ coverageInfo[i].functions = json[i].functions;
+ /*jshint loopfunc: true */
+ ['calledLines', 'calledFunctions', 'coveredLines', 'coveredFunctions'].forEach(function(prop) {
+ coverageInfo[i][prop] = coverageInfo[i][prop] || 0;
+ coverageInfo[i][prop] = Math.max(coverageInfo[i][prop], json[i][prop], 0);
+ });
+ }
}
}
};
@@ -198,9 +202,11 @@ var getYUIStatus = function(coverage) {
percent: 0
}, i, str;
for (i in coverage) {
- cov.lines = cov.lines + coverage[i].coveredLines;
- cov.miss = cov.miss + (coverage[i].coveredLines - coverage[i].calledLines);
- cov.hit = cov.hit + coverage[i].calledLines;
+ if (coverage.hasOwnProperty(i)) {
+ cov.lines = cov.lines + coverage[i].coveredLines;
+ cov.miss = cov.miss + (coverage[i].coveredLines - coverage[i].calledLines);
+ cov.hit = cov.hit + coverage[i].calledLines;
+ }
}
cov.percent = Math.floor((cov.hit / cov.lines) * 100);
View
@@ -127,5 +127,7 @@ mods = {
};
for (i in mods) {
- exports[i] = mods[i];
+ if (mods.hasOwnProperty(i)) {
+ exports[i] = mods[i];
+ }
}
View
@@ -68,8 +68,10 @@ var startTest = function(page, cb) {
i, name;
if (t) {
for (i in t) {
- name = i.replace('Test', '');
- t[name] = t[i];
+ if (t.hasOwnProperty(i)) {
+ name = i.replace('Test', '');
+ t[name] = t[i];
+ }
}
}
return (t ? true : false);

0 comments on commit b353bfb

Please sign in to comment.