Closed nsavelyeva closed 2 years ago
That's a npm-groovy-lint bug :/
I'l also the maintainer of npm-groovy-lint (but i have less available time), i'll have a look !
An update from my side.
Apparently, the error is caused by GROOVY_NPM_GROOVY_LINT_ARGUMENTS
option.
If I remove it, then GitHub Action workflows work as expected.
In my initial description of the issue the local execution command does not have that option and that is why the error is not observed there.
But if the option is used (as shown in the command below), then local execution will also be affected with this error.
npx mega-linter-runner -r insiders -e 'ENABLE=GROOVY' -e 'GROOVY_NPM_GROOVY_LINT_FILTER_REGEX_INCLUDE=src/main' -e 'GROOVY_NPM_GROOVY_LINT_CONFIG_FILE=conf/.groovylintrc-src-main.json' -e 'GROOVY_NPM_GROOVY_LINT_RULES_PATH=conf' -e 'GROOVY_NPM_GROOVY_LINT_ARGUMENTS=--output report/megalinter-src-main.html' -e 'PRINT_ALPACA=false' -e 'SHOW_ELAPSED_TIME=true'
I'm also having this issue after enabling HTML report output with npm-groovy-lint!
@nsavelyeva @GordonJess is it now better with npm-groovy-lint v9.0.0 ?
Hi @nvuillam, thanks for the response. I executed this command:
npx mega-linter-runner -r insiders -e 'ENABLE=GROOVY' -e 'GROOVY_NPM_GROOVY_LINT_FILTER_REGEX_EXCLUDE=Jenkinsfile.*' -e 'PRINT_ALPACA=false' -e 'SHOW_ELAPSED_TIME=true' -e 'GROOVY_NPM_GROOVY_LINT_ARGUMENTS=--output report/megalinter-src-main.html'
In the output I see it is using v9.0.0: Using [npm-groovy-lint v9.0.0] https://nvuillam.github.io/npm-groovy-lint/
But the error is still reproduced:
GroovyLint: Started CodeNarc Server
GroovyLint: Successfully processed CodeNarc:
CodeNarc completed: (p1=0; p2=2; p3=11) 4597ms
Unexpected error: Cannot read property 'totalFoundErrorNumber' of undefined
TypeError: Cannot read property 'totalFoundErrorNumber' of undefined
at NpmGroovyLint.manageReturnCode (/node_modules/npm-groovy-lint/lib/groovy-lint.js:479:49)
at NpmGroovyLint.postProcess (/node_modules/npm-groovy-lint/lib/groovy-lint.js:328:14)
at processTicksAndRejections (node:internal/process/task_queues:94:5)
at async NpmGroovyLint.run (/node_modules/npm-groovy-lint/lib/groovy-lint.js:66:13)
at async /node_modules/npm-groovy-lint/lib/index.js:12:9
This issue still exists, I believe it is because no errors were found :) I've tried to fix it locally to check but it is not working or I'm checking in a wrong way:
--- a/lib/codenarc-factory.js
+++ b/lib/codenarc-factory.js
@@ -139,11 +139,11 @@ async function parseCodeNarcResult(options, codeNarcBaseDir, codeNarcJsonResult,
// Parse main result
const pckgSummary = codeNarcJsonResult.summary;
- result.summary.totalFilesWithErrorsNumber = parseInt(pckgSummary.filesWithViolations, 10);
- result.summary.totalFilesLinted = parseInt(pckgSummary.totalFiles, 10);
- result.summary.totalFoundErrorNumber = parseInt(pckgSummary.priority1, 10);
- result.summary.totalFoundWarningNumber = parseInt(pckgSummary.priority2, 10);
- result.summary.totalFoundInfoNumber = parseInt(pckgSummary.priority3, 10);
+ result.summary.totalFilesWithErrorsNumber = parseInt(pckgSummary.filesWithViolations, 10) || 0;
+ result.summary.totalFilesLinted = parseInt(pckgSummary.totalFiles, 10) || 0;
+ result.summary.totalFoundErrorNumber = parseInt(pckgSummary.priority1, 10) || 0;
+ result.summary.totalFoundWarningNumber = parseInt(pckgSummary.priority2, 10) || 0;
+ result.summary.totalFoundInfoNumber = parseInt(pckgSummary.priority3, 10) || 0;
mmmm I think that the solution must be done within npm-groovy-lint instead of Mega-Linter
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.
If you think this issue should stay open, please remove the O: stale 🤖
label or comment on the issue.
Describe the bug Using GitHub Actions, Groovy linter fails with the below error on every Groovy file:
Unexpected error: Cannot read property 'totalFoundErrorNumber' of undefined
. Locally this error is not reproduced.To Reproduce Steps to reproduce the behavior:
Create a GitHub Action workflow, in my case I configured the job as follows:
totalFoundErrorNumber
error on every fileExpected behavior GitHub Actions produce no
totalFoundErrorNumber
errors, and has the same output as the local execution.Screenshots![Screenshot 2021-09-01 at 11 12 02](https://user-images.githubusercontent.com/21998320/131645592-f12f0433-7a12-4d30-950d-4c293c4808d2.png)
Additional context