Reformat everything (all C and C++ code) and enable format checks in GitHub workflow #1133
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.