Open ymber opened 4 years ago
another option that integrates with our current use of pre-commit.ci: https://github.com/pocc/pre-commit-hooks
My only worry with that one is that it appears to rely on system packages, and I've experienced issues e.g. with different major versions of clang-format producing slightly different output. (otherwise I have no complaints about clang-format.)
There are some other pre-commit hooks out there that attempt to vendor formatter binaries, with varying degrees of success. It's hard to make that reliable on all platforms, especially Linux.
DFHack has a code style specification and developing would be easier if things around that were automated. A config for astyle and CI checks to make sure C++ files are formatted would cover it.
The first 4 options in there will make files meet the style guide in Contributing.rst except for sorting includes and file encoding. The rest aren't specified in the style guide but it's worth considering standardizing them.
CI checks for formatting could use astyle with
--dry-run
to check if any files would be changed.