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

feat: lint all files in folder before panicking #2202

Merged
merged 7 commits into from
Oct 21, 2024

Conversation

Villaquiranm
Copy link
Contributor

@Villaquiranm Villaquiranm commented May 26, 2024

This Pull request intents to follow up on #2011. As said on that Pull request, currently we show all lint errors on the first analyzed file.
If in a folder we have a.gno & b.gno both with lint errors. gno lint | run | test will only find the errors related to one of those files.

This PR aims to show all the lint errors present on the current folder.

Changes:
for lint & test cmd:

  • we modified ParseMemPackage function on gnovm/pkg/gnoland/nodes.go. Before this function returned as soon as an error was found while Parsing the gno file. So we introduced an error slice to keep track of all Parse errors. After parsing all the files we panic with the list of errors only if this list is not empty.
  • we did the same on parseMemPackageTests function
  • create a function printRuntimeError that handles the print of the errors inside catchRuntimeError function. We did this change in order to be able to recursively call the funtion and handle the case of an []error type composed of scanner.ErrorList errors.

Results

  • running on gnovm/tests/integ/several-files-multiple/errors
    LINT (before):
several-files-multiple-errors % gno lint .
file2.gno:3: expected 'IDENT', found '{' (code=2).
file2.gno:5: expected type, found '}' (code=2).

LINT (after):

gno lint .
file2.gno:3: expected 'IDENT', found '{' (code=2).
file2.gno:5: expected type, found '}' (code=2).
main.gno:5: expected ';', found example (code=2).
main.gno:6: expected '}', found 'EOF' (code=2).
exit status 1
Contributors' checklist...
  • Added new tests, or not needed, or not feasible
  • Provided an example (e.g. screenshot) to aid review or the PR is self-explanatory
  • Updated the official documentation or not needed
  • No breaking changes were made, or a BREAKING CHANGE: xxx message was included in the description
  • Added references to related issues and PRs
  • Provided any useful hints for running manual tests
  • Added new benchmarks to generated graphs, if any. More info here.

Copy link

codecov bot commented May 26, 2024

Codecov Report

Attention: Patch coverage is 45.00000% with 11 lines in your changes missing coverage. Please review.

Project coverage is 62.58%. Comparing base (05cd4f5) to head (6db5fdc).
Report is 9 commits behind head on master.

Files with missing lines Patch % Lines
gnovm/cmd/gno/test.go 20.00% 3 Missing and 1 partial ⚠️
gnovm/pkg/gnolang/nodes.go 20.00% 3 Missing and 1 partial ⚠️
gnovm/cmd/gno/lint.go 70.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2202      +/-   ##
==========================================
- Coverage   63.10%   62.58%   -0.52%     
==========================================
  Files         564      564              
  Lines       79273    83717    +4444     
==========================================
+ Hits        50023    52397    +2374     
- Misses      25886    27824    +1938     
- Partials     3364     3496     +132     
Flag Coverage Δ
contribs/gnodev 60.00% <ø> (-0.63%) ⬇️
contribs/gnofaucet 14.82% <ø> (-0.95%) ⬇️
gno.land 67.56% <ø> (ø)
gnovm 67.25% <45.00%> (+0.01%) ⬆️
misc/genstd 79.72% <ø> (ø)
misc/logos 19.95% <ø> (ø)
tm2 62.26% <ø> (-0.09%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

gnovm/cmd/gno/lint.go Outdated Show resolved Hide resolved
gnovm/cmd/gno/test.go Outdated Show resolved Hide resolved
@Villaquiranm Villaquiranm force-pushed the lint-multiple-files branch 3 times, most recently from 955cb1a to 6be80ff Compare May 30, 2024 20:48
@thehowl thehowl merged commit 464c7f1 into gnolang:master Oct 21, 2024
120 of 121 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📦 🤖 gnovm Issues or PRs gnovm related
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants