npm-groovy-lint
Advanced tools
Comparing version 2.2.0-beta.7 to 2.2.0-beta.8
@@ -35,3 +35,6 @@ #! /usr/bin/env node | ||
// Initialize fix counters | ||
// Initialize counters | ||
this.updatedLintResult.summary.totalFoundErrorNumber = this.updatedLintResult.summary.totalFoundErrorNumber || 0; | ||
this.updatedLintResult.summary.totalFoundWarningNumber = this.updatedLintResult.summary.totalFoundWarningNumber || 0; | ||
this.updatedLintResult.summary.totalFoundInfoNumber || this.updatedLintResult.summary.totalFoundInfoNumber || 0; | ||
this.updatedLintResult.summary.totalFixedErrorNumber = this.updatedLintResult.summary.totalFixedErrorNumber || 0; | ||
@@ -260,7 +263,7 @@ this.updatedLintResult.summary.totalFixedWarningNumber = this.updatedLintResult.summary.totalFixedWarningNumber || 0; | ||
this.updatedLintResult.summary.totalRemainingErrorNumber = | ||
this.updatedLintResult.summary.totalErrorNumber - this.updatedLintResult.summary.totalFixedErrorNumber; | ||
this.updatedLintResult.summary.totalFoundErrorNumber - this.updatedLintResult.summary.totalFixedErrorNumber; | ||
this.updatedLintResult.summary.totalRemainingWarningNumber = | ||
this.updatedLintResult.summary.totalWarningNumber - this.updatedLintResult.summary.totalFixedWarningNumber; | ||
this.updatedLintResult.summary.totalFoundWarningNumber - this.updatedLintResult.summary.totalFixedWarningNumber; | ||
this.updatedLintResult.summary.totalRemainingInfoNumber = | ||
this.updatedLintResult.summary.totalInfoNumber - this.updatedLintResult.summary.totalFixedInfoNumber; | ||
this.updatedLintResult.summary.totalFoundInfoNumber - this.updatedLintResult.summary.totalFixedInfoNumber; | ||
@@ -267,0 +270,0 @@ // Return list of fixed error ids |
@@ -75,3 +75,3 @@ #! /usr/bin/env node | ||
await this.fixer.run(errorIds); | ||
this.lintResult = this.mergeResults(this.lintResult, this.fixer.updatedLintResult); | ||
this.lintResult = this.fixer.updatedLintResult; | ||
} | ||
@@ -261,3 +261,3 @@ | ||
this.lintResult = await this.parseCodeNarcResult(); | ||
// Fix when possible | ||
// Fix all found errors if requested | ||
if (this.options.fix) { | ||
@@ -302,5 +302,5 @@ this.fixer = new NpmGroovyLintFix(this.lintResult, { | ||
result.summary.totalFilesLinted = parseInt(pcgkSummary.totalFiles, 10); | ||
result.summary.totalErrorNumber = parseInt(pcgkSummary.priority1, 10); | ||
result.summary.totalWarningNumber = parseInt(pcgkSummary.priority2, 10); | ||
result.summary.totalInfoNumber = parseInt(pcgkSummary.priority3, 10); | ||
result.summary.totalFoundErrorNumber = parseInt(pcgkSummary.priority1, 10); | ||
result.summary.totalFoundWarningNumber = parseInt(pcgkSummary.priority2, 10); | ||
result.summary.totalFoundInfoNumber = parseInt(pcgkSummary.priority3, 10); | ||
@@ -396,16 +396,15 @@ // Parse files & violations | ||
// Pipes because variable content depends that if we run linter after fix or not | ||
// Reset properties and update counters | ||
updatedResults.files = {}; | ||
updatedResults.summary.totalErrorNumber = afterFixResults.summary.totalErrorNumber; | ||
updatedResults.summary.totalWarningNumber = afterFixResults.summary.totalWarningNumber; | ||
updatedResults.summary.totalInfoNumber = afterFixResults.summary.totalInfoNumber; | ||
updatedResults.summary.totalFixedErrorNumber = afterFixResults.summary.totalFixedErrorNumber; | ||
updatedResults.summary.totalFixedWarningNumber = afterFixResults.summary.totalFixedWarningNumber; | ||
updatedResults.summary.totalFixedInfoNumber = afterFixResults.summary.totalFixedInfoNumber; | ||
updatedResults.summary.totalFoundErrorNumber = afterFixResults.summary.totalFoundErrorNumber; | ||
updatedResults.summary.totalFoundWarningNumber = afterFixResults.summary.totalFoundWarningNumber; | ||
updatedResults.summary.totalFoundInfoNumber = afterFixResults.summary.totalFoundInfoNumber; | ||
updatedResults.summary.totalFixedErrorNumber = initialResults.summary.totalFixedErrorNumber; | ||
updatedResults.summary.totalFixedWarningNumber = initialResults.summary.totalFixedWarningNumber; | ||
updatedResults.summary.totalFixedInfoNumber = initialResults.summary.totalFixedInfoNumber; | ||
updatedResults.summary.fixedErrorsNumber = afterFixResults.summary.fixedErrorsNumber; | ||
updatedResults.summary.fixedErrorsIds = afterFixResults.summary.fixedErrorsIds; | ||
// Remove not fixed errors from initial result and add remaining errors of afterfixResults | ||
// Pipes because variable content depends that if we run linter after fix or not | ||
let fixedErrorsNumber = 0; | ||
const fixedErrorsIds = []; | ||
for (const fileNm of Object.keys(initialResults.files)) { | ||
@@ -416,6 +415,8 @@ const initialResfileErrors = initialResults.files[fileNm].errors; | ||
errors: afterFixResfileErrors, | ||
updatedSource: afterFixResults.files[fileNm].updatedSource || initialResults.files[fileNm].updatedSource | ||
updatedSource: initialResults.files[fileNm].updatedSource | ||
}; | ||
for (const initialFileError of initialResfileErrors) { | ||
if (initialFileError.fixed) { | ||
fixedErrorsNumber++; | ||
fixedErrorsIds.push(initialFileError.id); | ||
fileDtl.errors.push(initialFileError); | ||
@@ -426,2 +427,5 @@ } | ||
} | ||
updatedResults.summary.fixedErrorsNumber = fixedErrorsNumber; | ||
updatedResults.summary.fixedErrorsIds = fixedErrorsIds; | ||
return updatedResults; | ||
@@ -479,3 +483,3 @@ } | ||
Severity: "Error", | ||
"Total found": this.lintResult.summary.totalErrorNumber, | ||
"Total found": this.lintResult.summary.totalFoundErrorNumber, | ||
"Total fixed": this.lintResult.summary.totalFixedErrorNumber, | ||
@@ -486,3 +490,3 @@ "Total remaining": this.lintResult.summary.totalRemainingErrorNumber | ||
Severity: "Warning", | ||
"Total found": this.lintResult.summary.totalWarningNumber, | ||
"Total found": this.lintResult.summary.totalFoundWarningNumber, | ||
"Total fixed": this.lintResult.summary.totalFixedWarningNumber, | ||
@@ -493,3 +497,3 @@ "Total remaining": this.lintResult.summary.totalRemainingWarningNumber | ||
Severity: "Info", | ||
"Total found": this.lintResult.summary.totalInfoNumber, | ||
"Total found": this.lintResult.summary.totalFoundInfoNumber, | ||
"Total fixed": this.lintResult.summary.totalFixedInfoNumber, | ||
@@ -496,0 +500,0 @@ "Total remaining": this.lintResult.summary.totalRemainingInfoNumber |
{ | ||
"name": "npm-groovy-lint", | ||
"version": "2.2.0-beta.7", | ||
"version": "2.2.0-beta.8", | ||
"description": "NPM CodeNarc wrapper to easily lint Groovy files", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
15911775
1551