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
[typescript] Probable bug in parsing #1713
Comments
Thanks for the report, @msorens. I'll look into this. |
There is already some code to automatically intercept Parse_info exns to display their location, so better to use a consistent scheme across pfff and tree-sitter parsers. test plan: ``` (semgrep) pad@yrax:~/semgrep/tests/OTHER/parsing_errors$ semgrep -l ts -e 'FOO' . warn: parse error --> err.ts:2 2 | return 1+ | ^^^^^^^^^ = help: If the code appears to be valid, this may be a semgrep bug. Could not parse err.ts as ts Warnings exist. Run with `--strict` to turn warnings into errors. ``` better than the previous error that was always reported on the first line. This also improves error location for the errors reported in #1713
With the better error reporting I now get those parse error locations:
|
This can help in the futur to provide more information on the kind of constructs we do not parse well, which also makes it |
Some additional feedback: I just upgraded from 0.24 to 0.26 and I am seeing errors on the same two files as you show @aryx , but they are different errors !?!
|
yes the latest code for better error location is not yet in the release, it will be in 0.27 |
There is already some code to automatically intercept Parse_info exns to display their location, so better to use a consistent scheme across pfff and tree-sitter parsers. test plan: ``` (semgrep) pad@yrax:~/semgrep/tests/OTHER/parsing_errors$ semgrep -l ts -e 'FOO' . warn: parse error --> err.ts:2 2 | return 1+ | ^^^^^^^^^ = help: If the code appears to be valid, this may be a semgrep bug. Could not parse err.ts as ts Warnings exist. Run with `--strict` to turn warnings into errors. ``` better than the previous error that was always reported on the first line. This also improves error location for the errors reported in #1713
Just to be explicit, with 0.27.0 I am now seeing the revised error messages @aryx indicated. However, those files are all valid code, so those errors should not be present. |
@msorens a number of fixes are coming for typescript but still need integration work. They will become available most likely in the semgrep release two weeks from now. This includes:
|
Let's keep this open until we double check that the new release really fix the issue. |
Unless this is already working with the develop version @mjambon ? |
@aryx @mjambon This appears to still not parse. I ran a subset of the rules on one of the problematic files via Semgrep.dev: ❌ 0.27.0: https://semgrep.dev/s/GRBn/?version=0.27.0 |
Can we close this now? |
This is now fixed:
This is fixed too:
It's all good now, already released. |
Describe the bug
Running semgrep on my large-ish code base yielded these remarkably few probable parsing problems--nice job, folks!
These files compile cleanly and are currently running in production so, as far as I know, they should be parsable.
To Reproduce
My codebase is open source so you can go right to, well, the source: https://github.com/chef/automate/tree/master/components/automate-ui
Expected behavior
No parsing errors.
Environment
Version 0.24.0
The text was updated successfully, but these errors were encountered: