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

PrettierLintBear regex is incorrect #2365

Closed
saksham189 opened this issue Mar 18, 2018 · 12 comments · Fixed by #2414
Closed

PrettierLintBear regex is incorrect #2365

saksham189 opened this issue Mar 18, 2018 · 12 comments · Fixed by #2414

Comments

@saksham189
Copy link
Contributor

saksham189 commented Mar 18, 2018

The output of the prettierLintBear to stderr stream on syntax error for the input function b(){ is:
[error] ../../../../var/folders/x6/p95tfncj57q1lzsbbm02599xmts4q9/T/tmphekpuu5k: SyntaxError: Unexpected token (2:1)\n[error] 1 | function b(){\n[error] > 2 | \n[error] | ^\n.

This does not match r'L(?P<line>\d+)C(?P<column>\d+): (?P<message>.*)' the regex that is included inside the bear for stderr

@gitmate-bot
Copy link
Collaborator

GitMate.io thinks possibly related issues are #1532 (Regex linter), #2290 (PrettierLintBear: Add more tests), #512 (Bad User Experience), #1395 (PycodestyleBear: Ignore regex (^.*https?://)), and #450 (java/CheckstyleBear: incorrect regex).

@saksham189 saksham189 changed the title PrettierLintBear regex is bad PrettierLintBear regex is incorrect Mar 18, 2018
@ankitxjoshi
Copy link
Contributor

ankitxjoshi commented Mar 21, 2018

Yes, I see. It's a problem for any type of syntax error.

@saksham189
Copy link
Contributor Author

saksham189 commented Mar 21, 2018

updated the issue. An error is still thrown as corrected output is empty but stderr will never throw any error. This happens for every syntax error

@saksham189
Copy link
Contributor Author

Can you assign this to me @jayvdb

@newbazz
Copy link
Contributor

newbazz commented Apr 8, 2018

@anctartica are you still on this?

@jayvdb
Copy link
Member

jayvdb commented Apr 8, 2018

cc @Nshul

@saksham189
Copy link
Contributor Author

yes working will make a PR today

saksham189 added a commit to saksham189/coala-bears that referenced this issue Apr 8, 2018
saksham189 added a commit to saksham189/coala-bears that referenced this issue Apr 8, 2018
@jayvdb
Copy link
Member

jayvdb commented Apr 10, 2018

Maybe this is a version thing? Different versions produced different stderr?

@jayvdb
Copy link
Member

jayvdb commented Apr 10, 2018

#2421 is semi-related

@saksham189
Copy link
Contributor Author

When the PrettierBear was written not many tests were added. I later added the tests #2341 so, it is possible that this could have slipped. The format for the syntax error message produced by prettier is here: https://github.com/prettier/prettier/blob/master/src/common/parser-create-error.js which does not match the previous regex.

@Nshul
Copy link
Member

Nshul commented Apr 10, 2018

Apologies for my late response.
When PrettierBear was written not much tests were added. I am really sorry that the regex is incorrect, I took the idea of regex by looking at the official tutorial by coala and the other linter bears, it seemed fine on the tests i conducted.
i think i did miss the link @anctartica has sent from the official prettier repo.

@jayvdb
Copy link
Member

jayvdb commented Apr 10, 2018

Thanks for letting us know.

gitmate-bot pushed a commit to saksham189/coala-bears that referenced this issue Apr 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

7 participants