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(gnovm): add gno fmt command #2156

Merged
merged 79 commits into from
Jul 2, 2024
Merged

Conversation

gfanton
Copy link
Member

@gfanton gfanton commented May 20, 2024

Add gno fmt supporting gnoimports features.
For now, it supports the example folder along with stdlibs as defaults packages and add other source using -i flag.
In the future, it should possibly support a target chain so it can update imports based on what's on the chain (or using a gnoproxy).

Note for reviewer:

Most of the files edited in this pull request are actually formatted files. The reviewer should focus on:

  • gnovm/pkg/gnofmt
  • gnovm/cmd/fmt*

Additionally, some CI, Makefile, and other configuration files can require attention.

TODO:

  • Make resolver interface and move packages load into its specific implementations
  • Add gnofmt tests

NOTE: tests in gnofmt are minimal, most of the tests are written in txtar format in gnovm/cmd/gno/testdata/gno_fmt

gnoimports

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.

@gfanton gfanton self-assigned this May 20, 2024
@github-actions github-actions bot added the 🧾 package/realm Tag used for new Realms or Packages. label May 20, 2024
Copy link

codecov bot commented May 20, 2024

Codecov Report

Attention: Patch coverage is 53.33333% with 238 lines in your changes missing coverage. Please review.

Project coverage is 54.70%. Comparing base (f6ca518) to head (0386979).

Files Patch % Lines
gnovm/cmd/gno/fmt.go 55.00% 61 Missing and 11 partials ⚠️
gnovm/pkg/gnofmt/processor.go 59.00% 49 Missing and 17 partials ⚠️
gnovm/pkg/gnofmt/resolver.go 0.00% 42 Missing ⚠️
gnovm/pkg/gnofmt/package.go 49.29% 25 Missing and 11 partials ⚠️
gnovm/cmd/gno/util.go 55.55% 13 Missing and 3 partials ⚠️
gnovm/pkg/gnofmt/resolver_mock.go 83.87% 4 Missing and 1 partial ⚠️
gnovm/cmd/gno/transpile.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2156      +/-   ##
==========================================
- Coverage   54.73%   54.70%   -0.03%     
==========================================
  Files         584      590       +6     
  Lines       78531    79036     +505     
==========================================
+ Hits        42983    43236     +253     
- Misses      32336    32550     +214     
- Partials     3212     3250      +38     
Flag Coverage Δ
contribs/gnodev 23.81% <ø> (ø)
contribs/gnofaucet 15.31% <ø> (+0.85%) ⬆️
contribs/gnokeykc 0.00% <ø> (ø)
contribs/gnomd 0.00% <ø> (ø)
gno.land 62.68% <ø> (ø)
gnovm 59.80% <53.33%> (-0.18%) ⬇️
misc/autocounterd 0.00% <ø> (ø)
misc/genproto 0.00% <ø> (ø)
misc/genstd 73.90% <ø> (ø)
misc/goscan 0.00% <ø> (ø)
misc/logos 17.68% <ø> (ø)
misc/loop 0.00% <ø> (ø)
tm2 54.45% <ø> (-0.07%) ⬇️

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.

Signed-off-by: gfanton <[email protected]>
Signed-off-by: gfanton <[email protected]>
Signed-off-by: gfanton <[email protected]>
@gfanton gfanton marked this pull request as ready for review May 21, 2024 14:50
@gfanton gfanton requested review from a team, moul and thehowl as code owners May 21, 2024 14:50
Signed-off-by: gfanton <[email protected]>
Signed-off-by: gfanton <[email protected]>
@moul
Copy link
Member

moul commented May 21, 2024

I recommend renaming contribs/gnoimports to gno fmt to include gnoimports in our only official formatter. In the help message for gno fmt, explicitly mention that it includes gnoimports functionality. Additionally, integrate the checking part of gnoimports into gno lint for IDEs to detect issues.

@github-actions github-actions bot added the 📦 🤖 gnovm Issues or PRs gnovm related label May 23, 2024
@gfanton gfanton changed the title feat(contribs): add gnoimports feat(gnovm): add gno fmt command May 23, 2024
@gfanton gfanton marked this pull request as draft May 23, 2024 08:19
@gfanton gfanton requested a review from ajnavarro as a code owner June 24, 2024 08:33
@github-actions github-actions bot added the 📦 🌐 tendermint v2 Issues or PRs tm2 related label Jul 1, 2024
@gfanton gfanton merged commit 0572de4 into gnolang:master Jul 2, 2024
114 checks passed
@gfanton gfanton deleted the feat/dev/gnoimport branch July 2, 2024 16:43
gfanton added a commit to gfanton/gno that referenced this pull request Jul 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📦 🌐 tendermint v2 Issues or PRs tm2 related 📦 🤖 gnovm Issues or PRs gnovm related 🧾 package/realm Tag used for new Realms or Packages.
Projects
Status: Done
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants