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

Reformat everything (all C and C++ code) and enable format checks in GitHub workflow #1133

Closed

Conversation

johnbartholomew
Copy link
Collaborator

This touches ~everything by reformatting with clang-format on all .cpp and .h files (by running make reformat). And then enables the format checks in the GitHub workflow, to detect regressions.

However, note that in general unless everyone working on the code gets into the habit of having clang-format run automatically before commit (e.g., format-on-save in your editor) then regressions are extremely likely, and that is highly frustrating as it will lead to always failing format checks.

So we should consider whether we want to enforce formatting or not - if not, we can just delete the format-check part of the GitHub workflow and let people style code how they want (rely on manual review to prevent egregious stylistic problems). Or if we do want to enforce it then we probably need a smoother way of doing it - at least good instructions for how to configure various editors to format automatically, and probably a provided git pre-commit hook or something similar.

@johnbartholomew johnbartholomew marked this pull request as draft February 9, 2024 13:09
@johnbartholomew
Copy link
Collaborator Author

Currently breaks tests because some of the test data files have a .cpp extension which is caught by the auto format command.

Anyway, I'm going to postpone this PR for a while - as @sparkprime points out, there are many PRs in the queue, and if we want to merge any then it's much easier before all the files are touched for reformatting.

@johnbartholomew
Copy link
Collaborator Author

Uh... this is going to bitrot fast, because big reformat PRs always do. I'll just close it. Perhaps we can reformat incrementally instead.

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

Successfully merging this pull request may close these issues.

1 participant