Use pre-commit to check C++ and Python formatting
pre-commit is a very practical tool to automatically run checks on the files to be committed to the repository.
This MR adds a pre-commit configuration that invokes clang-format
and yapf
to replace the home made ci-utils/check-formatting
.
The only draw back is that the available versions of clang-format
start from 10, so there is a minor difference in the output when using it instead of clang-format-8
: the fixed the discrepancy between constructors invoked with parentheses and braces, so we get
std::string a( "a" );
std::string b{ "b" };
instead of
std::string a( "a" );
std::string b{"b"};
When we merge this, we can decide if to format everything or update the formatting only of the files we touch in each MR.