coffeelint-reporter
Advanced tools
Comparing version 2.0.0 to 2.0.1
@@ -13,4 +13,11 @@ # CHANGELOG | ||
> - Documentation | ||
> - Enhancements | ||
> - Internal | ||
## v2.0.1 (2019-12-13) | ||
#### Enhancements | ||
- Remove errors and warnings count in log ([30f418f](https://github.com/sibiraj-s/coffeelint-reporter/commit/30f418f)) | ||
## v2.0.0 (2019-12-12) | ||
@@ -17,0 +24,0 @@ |
{ | ||
"name": "coffeelint-reporter", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "A Reporter for Coffeelint", | ||
@@ -5,0 +5,0 @@ "author": "sibiraj-s", |
@@ -34,15 +34,14 @@ const chalk = require('chalk'); | ||
const isWin = process.platform === 'win32'; | ||
const warnSign = '' + (isWin ? '' : '⚠'); | ||
const errSign = '' + (isWin ? '' : '✖'); | ||
const tickSign = '' + (isWin ? '' : '✔'); | ||
const warnSign = isWin ? '' : '⚠'; | ||
const errSign = isWin ? '' : '✖'; | ||
const tickSign = isWin ? '' : '✔'; | ||
let report; | ||
let errors = 0; | ||
let warnings = 0; | ||
let formattedReport; | ||
if (fileName) { | ||
formattedReport = '\n' + chalk.green(chalk.underline(fileName)) + '\n'; | ||
report = '\n' + chalk.green(chalk.underline(fileName)) + '\n'; | ||
} else { | ||
formattedReport = '\n'; | ||
report = '\n'; | ||
} | ||
@@ -52,13 +51,5 @@ | ||
results.forEach(function (result) { | ||
let hasError = false; | ||
const hasError = result.level === 'error'; | ||
hasError ? errors++ : warnings++; | ||
if (result.level === 'error') { | ||
hasError = true; | ||
errors++; | ||
} | ||
if (result.level === 'warn') { | ||
warnings++; | ||
} | ||
table.push([ | ||
@@ -72,32 +63,18 @@ chalk[hasError ? 'red' : 'yellow'](hasError ? errSign : warnSign), | ||
formattedReport += table.toString(); | ||
report += table.toString(); | ||
} | ||
if (warnings || errors) { | ||
formattedReport += '\n\n Completd with '; | ||
if (warnings) { | ||
formattedReport += chalk.yellow(warnings + ' warning' + (warnings === 1 ? '' : 's')); | ||
} | ||
if (warnings && errors) { | ||
formattedReport += ', '; | ||
} | ||
if (errors) { | ||
formattedReport += chalk.red(errors + ' error' + (errors === 1 ? '' : 's')); | ||
} | ||
} else { | ||
formattedReport += chalk.green(tickSign + ' No Problem'); | ||
if (!warnings && !errors) { | ||
report += chalk.green(` ${tickSign} No Problems`); | ||
} | ||
formattedReport = formattedReport.replace(/(\r\n|\r|\n){2,}/g, '$1\n'); | ||
report = report.replace(/(\r\n|\r|\n){2,}/g, '$1\n'); | ||
if (options.log) { | ||
console.log(formattedReport); | ||
console.log(report); | ||
} | ||
return formattedReport; | ||
return report; | ||
}; | ||
module.exports = reporter; |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
9168
78