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

Formatting the code #123

Open
benjub opened this issue Jan 14, 2023 · 3 comments
Open

Formatting the code #123

benjub opened this issue Jan 14, 2023 · 3 comments

Comments

@benjub
Copy link
Collaborator

benjub commented Jan 14, 2023

I think that to ensure consistent coding style, we should agree on a code formatter to use (and even make it part of CI ?). Are there standard tools to format/indent C code ?

I saw AStyle and clang-format mentioned on https://stackoverflow.com/questions/841075/best-c-code-formatter-beautifier. Or simply GNU indent ?

@digama0
Copy link
Member

digama0 commented Jan 15, 2023

Lean uses Google style guide and the page also mentions a style linter that we could borrow for our own use. I would try to set all the config options to match the current style as close as you can, and then enable it in CI.

@benjub
Copy link
Collaborator Author

benjub commented Jan 15, 2023

I don't have much expertise, here. Plus, to enable it in CI (that is, not only check formatting, but actually perform it), one needs special rights for the repository. Unfortunately, I cannot do it, though I think that having such an automated formatting would simplify some tasks in #17.

@digama0
Copy link
Member

digama0 commented Jan 15, 2023

FWIW, in lean it's not actually auto-applied, it's a CI check which is run as if it were a test case. The intended workflow is for developers to run the tests and manually correct any flagged issues. We probably want an auto-formatter for the initial pass though, and it would also be helpful so that people can enable it using some run-on-save functionality in their editors.

Unfortunately I don't have the time to investigate and test these formatters. If you don't either I don't mind leaving this issue open for a while.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants