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: improve gno linter with basic errors support #1202

Merged
merged 34 commits into from
Jan 22, 2024

Conversation

gfanton
Copy link
Member

@gfanton gfanton commented Oct 6, 2023

I've improved the linter by using RunMemPackage in the same way that gno test does for testing.
A direct use case for this PR is to provide a simple and reliable method for editors to integrate gno linting.

(There might be a better way to achieve what I've done, of which I'm not aware)


Below a sample of gno lint output:

Screenshot 2023-10-06 at 23 00 06

And here's a brief demo using basic integration with emacs:

gnolint

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.

Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
from `testscripts` doc.go:

UpdateScripts specifies that if a `cmp` command fails and its second
argument refers to a file inside the testscript file, the command will
succeed and the testscript file will be updated to reflect the actual
content (which could be stdout, stderr or a real file).

The content will be quoted with txtar.Quote if needed;
a manual change will be needed if it is not unquoted in the
script.

Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
@gfanton gfanton self-assigned this Oct 6, 2023
@gfanton gfanton requested review from jaekwon, moul and a team as code owners October 6, 2023 21:15
@github-actions github-actions bot added the 📦 🤖 gnovm Issues or PRs gnovm related label Oct 6, 2023
@codecov
Copy link

codecov bot commented Oct 6, 2023

Codecov Report

Attention: 17 lines in your changes are missing coverage. Please review.

Comparison is base (6112ffd) 55.95% compared to head (0e4dad1) 56.05%.

Files Patch % Lines
gnovm/cmd/gno/lint.go 86.58% 9 Missing and 2 partials ⚠️
gnovm/tests/file.go 33.33% 4 Missing ⚠️
gnovm/pkg/gnolang/preprocess.go 77.77% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1202      +/-   ##
==========================================
+ Coverage   55.95%   56.05%   +0.10%     
==========================================
  Files         435      435              
  Lines       66306    66409     +103     
==========================================
+ Hits        37101    37228     +127     
+ Misses      26303    26287      -16     
+ Partials     2902     2894       -8     
Flag Coverage Δ
go-1.21.x ∅ <ø> (∅)
misc ∅ <ø> (∅)
misc-_test.genstd ∅ <ø> (∅)

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.

@gfanton gfanton requested a review from harry-hov October 6, 2023 21:56
Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
@gfanton gfanton changed the title feat: improve gno linter feat: improve gno linter with basic errors support Oct 9, 2023
@moul
Copy link
Member

moul commented Oct 9, 2023

Related with #1215.

gnovm/pkg/gnolang/preprocess.go Show resolved Hide resolved
gnovm/cmd/gno/lint.go Outdated Show resolved Hide resolved
@github-actions github-actions bot added the 🧾 package/realm Tag used for new Realms or Packages. label Oct 20, 2023
Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
@gfanton gfanton requested a review from thehowl October 20, 2023 16:59
Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
Copy link
Member

@thehowl thehowl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a test that makes sure that the preprocess stack is still printed in other places (ie. a normal stacktrace?)

thx

gnovm/cmd/gno/lint.go Outdated Show resolved Hide resolved
gnovm/cmd/gno/lint.go Outdated Show resolved Hide resolved
gnovm/cmd/gno/lint.go Outdated Show resolved Hide resolved
gnovm/pkg/gnolang/debug.go Outdated Show resolved Hide resolved
gnovm/pkg/gnolang/debug.go Outdated Show resolved Hide resolved
Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
Copy link
Member

@moul moul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add an example in CONTRIBUTING.md to use it with your editor?

Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
@gfanton
Copy link
Member Author

gfanton commented Dec 11, 2023

@moul added integration for emacs + vim (Im not sure this is the usual way for the last one, but at last it works)

@gfanton gfanton requested a review from thehowl January 11, 2024 15:04
@gfanton gfanton requested a review from piux2 as a code owner January 22, 2024 13:36
@thehowl thehowl merged commit d6243b4 into gnolang:master Jan 22, 2024
189 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: 🌟 Wanted for Launch
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants