Skip to content
Snippets Groups Projects

Use pre-commit to check C++ and Python formatting

Merged Marco Clemencic requested to merge add-pre-commit-config into master

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.

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
Please register or sign in to reply
Loading