Closed johnbartholomew closed 8 months ago
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.
Uh... this is going to bitrot fast, because big reformat PRs always do. I'll just close it. Perhaps we can reformat incrementally instead.
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.