Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using --noserver picks up no issues and returns Passed even when there are issues #290

Closed
colossusb opened this issue Sep 14, 2023 · 8 comments

Comments

@colossusb
Copy link

Summary

Running with '--noserver' does not pick up issues yet everything appears Passed
This has been run on serveral different machines and always replicates as below.
Wondering if perhaps some CodeNarc update has broken this?

Might be related to #284 ?

To Replicate

  1. Make some obvious error in your code
  2. Run 'npm-groovy-lint ' to confirm the error is picked up
  3. Run 'npm-groovy-lint --noserver' and witness the error is not picked up

Versions

npm-groovy-lint --version
GroovyLint: Successfully processed CodeNarc: 
CodeNarc version 3.1.0

npm-groovy-lint version 11.1.1

Embeds:
CodeNarc version 3.1.0
- Groovy version 3.0.9 (superlite)

OS's
Ventura
Linux

Example

me@mymachine my_folder % npm-groovy-lint ./vars/addSshAuthorizedKeys.groovy           
/Users/me/PycharmProjects/my_folder/vars/addSshAuthorizedKeys.groovy
  10    error    Unexpected input: '[\n        whoops_I_put_a_Bunch_of_Crap_in_My_Code\n        'publicKey'' @ line 10, column 9.  NglParseError           


npm-groovy-lint results in 1 linted files:
┌─────────┬───────────┬─────────────┐
│ (index) │ Severity  │ Total found │
├─────────┼───────────┼─────────────┤
│    0    │  'Error'  │      1      │
│    1    │ 'Warning' │      0      │
│    2    │  'Info'   │      0      │
└─────────┴───────────┴─────────────┘
Failure: 1 error(s) have been found 
 0 warning(s) have been found 
 0 info(s) have been found
me@mymachine my_folder % npm-groovy-lint ./vars/addSshAuthorizedKeys.groovy --noserver

npm-groovy-lint results in 0 linted files:
┌─────────┬───────────┬─────────────┐
│ (index) │ Severity  │ Total found │
├─────────┼───────────┼─────────────┤
│    0    │  'Error'  │      0      │
│    1    │ 'Warning' │      0      │
│    2    │  'Info'   │      0      │
└─────────┴───────────┴─────────────┘
@colossusb colossusb changed the title Using --noserver picks up no issues but returns Passed Using --noserver picks up no issues and returns Passed even when there are issues Sep 14, 2023
@github-actions
Copy link

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.

@yermulnik
Copy link

Same here 😢

> npm ls -g
/home/giermulnik/.npm-global/lib
└── npm-groovy-lint@11.1.1

> npm-groovy-lint --noserver ./test.jenkinsfile

npm-groovy-lint results in 0 linted files:
┌─────────┬───────────┬─────────────┐
│ (index) │ Severity  │ Total found │
├─────────┼───────────┼─────────────┤
│    0    │  'Error'  │      0      │
│    1    │ 'Warning' │      0      │
│    2    │  'Info'   │      0      │
└─────────┴───────────┴─────────────┘

@tbroyer
Copy link

tbroyer commented Nov 9, 2023

Running into the same problem as well. This is indeed #284 and the analysis here is correct: this code needs to be applied in callCodeNarcJava as well as callCodeNarcServer:

// Remove "" around values because they won't get thru system command line parser
const codeNarcArgsForServer = this.codenarcArgs.map(codeNarcArg => {
if (codeNarcArg.includes('="') || codeNarcArg.includes(':"')) {
codeNarcArg = codeNarcArg
.replace('="', "=")
.replace(':"', ":")
.replace(/ /g, "%20");
codeNarcArg = codeNarcArg.substring(0, codeNarcArg.length - 1);
}
return codeNarcArg;
});

Workaround

Pass dummy arguments before and after your file list:

$ npm-groovy-lint --noserver dummy ./vars/addSshAuthorizedKeys.groovy dummy

@tbroyer
Copy link

tbroyer commented Nov 9, 2023

And/or maybe npm-groovy-lint should not include quotes in the -includes parameter when it builds it?

result.codenarcArgs.push(`-includes="${patternsFinal}"`);

@nvuillam
Copy link
Owner

Would anyone here submit a PR with the fix ? :)

@nvuillam
Copy link
Owner

This problem might be solved in v13.0.0, do you still have it ?

@tbroyer
Copy link

tbroyer commented Nov 27, 2023

I confirm this now works as expected with 13.0.0.

@nvuillam
Copy link
Owner

Thanks a lot for your feedback :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants