gno icon indicating copy to clipboard operation
gno copied to clipboard

feat(gnovm): enforce formatting of added packages

Open moul opened this issue 7 months ago • 2 comments

RFC: Should we enforce basic code formatting, verify and return an error for bad formatting, or accept bad formatting?


This PR introduces the concept of automatically formatting packages during AddPkg. The advantage is that it's relatively inexpensive since we were already parsing the submitted source code AST to apply some verification.

I believe that having a consistent official formatting for the Go language is one of the things that makes it better, simpler, and more readable. I think Gno should strive to be as good as or better than Go in this regard.

Another justification for this approach is that Gno is not just the language but a platform (gno.land), like a PAAS, and AddPkg can be considered the "CD" process, while auto-formatting could be the "CI" component, which often go hand-in-hand in "CI/CD".

The biggest drawback I can see is that in practice, the code content may not be the same on the publisher's computer and on-chain.

moul avatar Jun 29 '24 06:06 moul