coverage-blamer
Advanced tools
Comparing version 0.1.8 to 0.1.9
@@ -17,3 +17,3 @@ // Generated by CoffeeScript 1.10.0 | ||
commander.version(package_info.version).option('-c, --coverage <path>', 'Path to coverage report').option('-v, --vcs [type]', 'Version control system', 'git').option('-s, --source <path>', 'Path to source folder').option('-o, --output <path>', 'Path to output folder').option('-r, --disableRow <boolean>', 'Disable row coverage in report', true).parse(process.argv); | ||
commander.version(package_info.version).option('-c, --coverage <path>', 'Path to coverage report').option('-v, --vcs [type]', 'Version control system', 'git').option('-s, --source <path>', 'Path to source folder').option('-o, --output <path>', 'Path to output folder').option('-r, --disableRow <boolean>', 'Disable row coverage in report', true).option('-m, --useMarkdown <boolean>', 'Use markdown for cli output', false).parse(process.argv); | ||
@@ -25,3 +25,4 @@ options = { | ||
src: commander.source, | ||
disableRow: commander.disableRow | ||
disableRow: commander.disableRow, | ||
useMarkdown: commander.useMarkdown | ||
}; | ||
@@ -28,0 +29,0 @@ |
// Generated by CoffeeScript 1.10.0 | ||
(function() { | ||
var Table, createDir, fs, jade, koutoSwiss, mkdirp, path, stylus, writeFile; | ||
var Table, createDir, fs, jade, koutoSwiss, mdTable, mkdirp, path, printCli, printCliMd, stylus, writeFile; | ||
@@ -19,2 +19,4 @@ path = require('path'); | ||
mdTable = require('markdown-table'); | ||
createDir = function(dirname) { | ||
@@ -37,2 +39,36 @@ if (!fs.existsSync(dirname)) { | ||
printCli = function(data, options) { | ||
var authors, authorsTable, dates, datesTable, files, filesTable; | ||
if (options.useMarkdown) { | ||
return printCliMd(data); | ||
} | ||
authors = data.authors, files = data.files, dates = data.dates; | ||
authorsTable = new Table({ | ||
head: authors.head, | ||
colWidths: authors.colWidths | ||
}); | ||
authorsTable.push.apply(authorsTable, authors.data); | ||
filesTable = new Table({ | ||
head: files.head, | ||
colWidths: files.colWidths | ||
}); | ||
filesTable.push.apply(filesTable, files.data); | ||
datesTable = new Table({ | ||
head: dates.head, | ||
colWidths: dates.colWidths | ||
}); | ||
datesTable.push.apply(datesTable, dates.data); | ||
console.log(authorsTable.toString()); | ||
console.log(filesTable.toString()); | ||
return console.log(datesTable.toString()); | ||
}; | ||
printCliMd = function(arg) { | ||
var authors, dates, files; | ||
authors = arg.authors, files = arg.files, dates = arg.dates; | ||
console.log(mdTable(authors), '\n'); | ||
console.log(mdTable(files), '\n'); | ||
return console.log(mdTable(dates)); | ||
}; | ||
module.exports = { | ||
@@ -68,48 +104,48 @@ html: function(result, options) { | ||
cli: function(result, options) { | ||
var author, authorsTable, coverage, dateString, datesTable, file, filesTable; | ||
authorsTable = new Table({ | ||
head: ['Author', 'Lines', 'Uncovered Lines', 'Coverage'], | ||
colWidths: [50, 15, 15, 15] | ||
}); | ||
filesTable = new Table({ | ||
head: ['File', 'Lines', 'Uncovered Lines', 'Coverage'], | ||
colWidths: [50, 15, 15, 15] | ||
}); | ||
datesTable = new Table({ | ||
head: ['Date', 'Lines', 'Uncovered Lines', 'Coverage'], | ||
colWidths: [50, 15, 15, 15] | ||
}); | ||
authorsTable.push.apply(authorsTable, (function() { | ||
var results; | ||
results = []; | ||
for (author in result.authors) { | ||
results.push([result.authors[author].author, result.authors[author].lines, result.authors[author].uncoveredLines, result.authors[author].coverage.toFixed(2) + "%"]); | ||
var author, coverage, data, dateString, file; | ||
data = { | ||
authors: { | ||
head: ['Author', 'Lines', 'Uncovered Lines', 'Coverage'], | ||
colWidths: [50, 15, 15, 15], | ||
data: [].concat((function() { | ||
var results; | ||
results = []; | ||
for (author in result.authors) { | ||
results.push([result.authors[author].author, result.authors[author].lines, result.authors[author].uncoveredLines, result.authors[author].coverage.toFixed(2) + "%"]); | ||
} | ||
return results; | ||
})()) | ||
}, | ||
files: { | ||
head: ['File', 'Lines', 'Uncovered Lines', 'Coverage'], | ||
colWidths: [50, 15, 15, 15], | ||
data: [].concat((function() { | ||
var i, len, ref, results; | ||
ref = result.files; | ||
results = []; | ||
for (i = 0, len = ref.length; i < len; i++) { | ||
file = ref[i]; | ||
if (file.coverage !== 100) { | ||
results.push([file.filename, file.lines, file.uncoveredLines, file.coverage.toFixed(2) + "%"]); | ||
} | ||
} | ||
return results; | ||
})()) | ||
}, | ||
dates: { | ||
head: ['Date', 'Lines', 'Uncovered Lines', 'Coverage'], | ||
colWidths: [50, 15, 15, 15], | ||
data: [].concat((function() { | ||
var ref, results; | ||
ref = result.dates; | ||
results = []; | ||
for (dateString in ref) { | ||
coverage = ref[dateString]; | ||
results.push([(new Date(parseInt(dateString + "000"))).toDateString(), coverage.lines, coverage.uncoveredLines, coverage.coverage ? coverage.coverage.toFixed(2) + "%" : '100.00%']); | ||
} | ||
return results; | ||
})()) | ||
} | ||
return results; | ||
})()); | ||
filesTable.push.apply(filesTable, (function() { | ||
var i, len, ref, results; | ||
ref = result.files; | ||
results = []; | ||
for (i = 0, len = ref.length; i < len; i++) { | ||
file = ref[i]; | ||
if (file.coverage !== 100) { | ||
results.push([file.filename, file.lines, file.uncoveredLines, file.coverage.toFixed(2) + "%"]); | ||
} | ||
} | ||
return results; | ||
})()); | ||
datesTable.push.apply(datesTable, (function() { | ||
var ref, results; | ||
ref = result.dates; | ||
results = []; | ||
for (dateString in ref) { | ||
coverage = ref[dateString]; | ||
results.push([(new Date(parseInt(dateString + "000"))).toDateString(), coverage.lines, coverage.uncoveredLines, coverage.coverage ? coverage.coverage.toFixed(2) + "%" : '100.00%']); | ||
} | ||
return results; | ||
})()); | ||
console.log(authorsTable.toString()); | ||
console.log(filesTable.toString()); | ||
return console.log(datesTable.toString()); | ||
}; | ||
return printCli(data, options); | ||
} | ||
@@ -116,0 +152,0 @@ }; |
{ | ||
"name": "coverage-blamer", | ||
"version": "0.1.8", | ||
"version": "0.1.9", | ||
"description": "coverage-blamer is tool for get information about authors of uncovered code", | ||
@@ -43,2 +43,3 @@ "main": "index.js", | ||
"lodash": "~3.10.x", | ||
"markdown-table": "^0.4.0", | ||
"mkdirp": "^0.5.x", | ||
@@ -45,0 +46,0 @@ "stylus": "^0.53.0" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
32475
456
12
+ Addedmarkdown-table@^0.4.0
+ Addedmarkdown-table@0.4.0(transitive)