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

Improve error reporting to include a few lines of context #110

Closed
mjambon opened this issue Sep 17, 2020 · 2 comments
Closed

Improve error reporting to include a few lines of context #110

mjambon opened this issue Sep 17, 2020 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@mjambon
Copy link
Member

mjambon commented Sep 17, 2020

Currently, we report only the token on which tree-sitter choked, an ERROR node. This is usually not sufficient to understand what the problem is. Instead, the error message should include a few lines before and after the problematic snippet, which itself would be highlighted (if writing to the console).

This is especially useful when triaging a large number of errors when scanning many large projects.

@mjambon mjambon added the enhancement New feature or request label Sep 17, 2020
@aryx
Copy link
Collaborator

aryx commented Sep 18, 2020

Actually you can raise one of the exception in Parse_info.ml and later semgrep will autimatically show context lines. You need to construct a Parse_info.t but there is already a function for that in parse_treesitter_helper.ml

@aryx
Copy link
Collaborator

aryx commented Sep 22, 2020

related: semgrep/semgrep#1713 where semgrep reports just the error at the first line, because that's what it does when there's no other precise line information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

2 participants