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

--noserver does not honor --parse #323

Closed
tbroyer opened this issue Nov 9, 2023 · 5 comments · Fixed by #348
Closed

--noserver does not honor --parse #323

tbroyer opened this issue Nov 9, 2023 · 5 comments · Fixed by #348
Labels
question Further information is requested

Comments

@tbroyer
Copy link

tbroyer commented Nov 9, 2023

Tracking differences between using --noserver or not (see #290), I stumbled on another difference: a file with a parse error will be seen as OK with --noserver, whereas it will fail without.

Fwiw, the reason for using --noserver is that I'm using npm-groovy-lint through Docker (on CI, but also locally), so starting a server for a one-shot analysis seemed unnecessary.
Given that --noserver is also used as a fallback for when the server codepath fails, I expect it to behave the same.

$ alias insidedocker
alias insidedocker='docker run --rm -it -u $(id -u):$(id -g) -v "$PWD:$PWD" -w "$PWD"'
$ insidedocker nvuillam/npm-groovy-lint:11.1.1 vars/utils.groovy
***REDACTED***/vars/utils.groovy
  17    error    Unexpected input: '***REDACTED***' @ line 17, column 1.  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
$ insidedocker nvuillam/npm-groovy-lint:11.1.1 --noserver dummy vars/utils.groovy dummy

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

(using version 11.1.1 here due to #319)

@nvuillam
Copy link
Owner

@tbroyer please can you check with v13.0.0 ? :)

@tbroyer
Copy link
Author

tbroyer commented Nov 27, 2023

Nope, no change with 13.0.0:

$ alias insidedocker
alias insidedocker='docker run --rm -it -u $(id -u):$(id -g) -v "$PWD:$PWD" -w "$PWD"'
$ insidedocker nvuillam/npm-groovy-lint:v13.0.0 vars/utils.groovy
***REDACTED***/vars/utils.groovy
  56    error    Unexpected input: '***REDACTED***' @ line 56, column 1.  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
$ insidedocker nvuillam/npm-groovy-lint:v13.0.0 --noserver vars/utils.groovy

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

@nvuillam
Copy link
Owner

Parsing is done within the CodeNarc server... and with --noserver we directly call CodeNarc... it's possible than --noserver makes that limitation , we should update the doc :/

@stevenh
Copy link
Collaborator

stevenh commented Dec 18, 2023

I wouldn't expect it to differ, do you have an example you can share to test locally?

@stevenh stevenh added the question Further information is requested label Dec 18, 2023
@tbroyer
Copy link
Author

tbroyer commented Dec 18, 2023

Sure, using the WithParseError.groovy from lib/examples (here):

$ alias insidedocker
alias insidedocker='docker run --rm -it -u $(id -u):$(id -g) -v "$PWD:$PWD" -w "$PWD"'
$ insidedocker nvuillam/npm-groovy-lint:v14.0.0 WithParseError.groovy 
***REDACTED***/WithParseError.groovy
  3     error    Unexpected input: '\n' @ line 3, column 20.  NglParseError           
  5     info     Static imports should appear before normal imports  MisorderedStaticImports 
  43    warning  The line exceeds 120 characters. The line is 133 characters.  LineLength              


npm-groovy-lint results in 1 linted files:
┌─────────┬───────────┬─────────────┐
│ (index) │ Severity  │ Total found │
├─────────┼───────────┼─────────────┤
│    0    │  'Error'  │      1      │
│    1    │ 'Warning' │      1      │
│    2    │  'Info'   │      1      │
└─────────┴───────────┴─────────────┘
Failure: 1 error(s) have been found 
 1 warning(s) have been found 
 1 info(s) have been found
$ insidedocker nvuillam/npm-groovy-lint:v14.0.0 --noserver WithParseError.groovy 
***REDACTED***/WithParseError.groovy
  5     info     Static imports should appear before normal imports  MisorderedStaticImports 
  43    warning  The line exceeds 120 characters. The line is 133 characters.  LineLength              


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

stevenh added a commit that referenced this issue Dec 18, 2023
Refactor request processing so that the flow is the same with and
without --noserver command line option which was preventing parse errors
being reported when --noserver was specified.

Add duration in milliseconds to request logging so we easily monitor how
long the server side requests are taking.

Explicitly handle 404 errors so we don't needlessly retry them with a
slow direct request.

Use chaining to improve readability.

Fixes #323
stevenh added a commit that referenced this issue Dec 18, 2023
Refactor request processing so that the flow is the same with and
without --noserver command line option which was preventing parse errors
being reported when --noserver was specified.

Add duration in milliseconds to request logging so we easily monitor how
long the server side requests are taking.

Explicitly handle 404 errors so we don't needlessly retry them with a
slow direct request.

Use chaining to improve readability.

Fixes #323
stevenh added a commit that referenced this issue Dec 18, 2023
Refactor request processing so that the flow is the same with and
without --noserver command line option which was preventing parse errors
being reported when --noserver was specified.

Add duration in milliseconds to request logging so we easily monitor how
long the server side requests are taking.

Explicitly handle 404 errors so we don't needlessly retry them with a
slow direct request.

Use chaining to improve readability.

Switch to java.time.* instead of Date as recommended by CodeNarc.

Fixes #323
stevenh added a commit that referenced this issue Dec 19, 2023
Refactor request processing so that the flow is the same with and
without --noserver command line option which was preventing parse errors
being reported when --noserver was specified.

Add duration in milliseconds to request logging so we easily monitor how
long the server side requests are taking.

Explicitly handle 404 errors so we don't needlessly retry them with a
slow direct request.

Use chaining to improve readability.

Switch to java.time.* instead of Date as recommended by CodeNarc.

Fixes #323
nvuillam pushed a commit that referenced this issue Dec 20, 2023
Refactor request processing so that the flow is the same with and
without --noserver command line option which was preventing parse errors
being reported when --noserver was specified.

Add duration in milliseconds to request logging so we easily monitor how
long the server side requests are taking.

Explicitly handle 404 errors so we don't needlessly retry them with a
slow direct request.

Use chaining to improve readability.

Switch to java.time.* instead of Date as recommended by CodeNarc.

Fixes #323
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants