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

quint: Apply a standard formatting for .qnt files #582

Open
cason opened this issue Nov 20, 2024 · 4 comments
Open

quint: Apply a standard formatting for .qnt files #582

cason opened this issue Nov 20, 2024 · 4 comments
Labels
spec Related to specifications tech-debt Not high priority, to eventually be addressed.

Comments

@cason
Copy link
Contributor

cason commented Nov 20, 2024

At the moment, apparently we have the following standards:

  • Tabulations consist of two spaces
  • Comments starting with /// are interpreted as documentation for the function

Most of the Quint files in the repository don't follow this standard.

And, unfortunately, we do not have a kind of quint fmt command to standardize formatting.

@cason cason added spec Related to specifications tech-debt Not high priority, to eventually be addressed. labels Nov 20, 2024
@josef-widder josef-widder assigned bugarela and unassigned bugarela Nov 20, 2024
@josef-widder
Copy link
Member

I am tagging @bugarela here, in the hope that she can help us there.

@bugarela
Copy link

Issue on the Quint repo: informalsystems/quint#1419
This is, in theory, not of great priority. In practice, it's popping up in every single project using Quint, so I can't wait to have it.

Yesterday I explored doing something using Topiary which simplifies implementation since we can use the tree-sitter grammar to handle the hard part and then just tell it how formatting should look like. However, I wrote our tree-sitter grammar in a pi-week last year and it's not 100% complete, so I need to finish it and define formatting rules for everything.

I'll aim to do this slowly (a few hours/week) and see where we can get by the end of the year.

@romac romac changed the title quint: apply a standard formatting for .qnt files quint: Apply a standard formatting for .qnt files Dec 19, 2024
@cason
Copy link
Contributor Author

cason commented Jan 6, 2025

While the Quint side of the solution is not implemented, we could establish a standard and I can apply it to all source code.

@josef-widder, do you mind writing a list of standards to be applied? I can perform the boring work afterwards.

@josef-widder
Copy link
Member

Not sure I even know what I would have to specify for this list. I guess the two spaces and consistent documentation with "///" of functions (mentioned in the beginning of this issue) would be good to have.

I guess @bugarela also doesn't like (and I agree with her)

  • redundant curly brackets within if and else branches
  • with (should be replaced with the { ...x, b: example} syntax)

Then there is the question of camel case vs. underscore. I think in Malachite we use camel case quite consistently, so I would stick to it, although @bugarela most likely would prefer we move away from that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
spec Related to specifications tech-debt Not high priority, to eventually be addressed.
Projects
None yet
Development

No branches or pull requests

3 participants