Skip to content

Use pre-commit for formatting, flake8 and additional checks

Marco Clemencic requested to merge use-pre-commit into master

With this MR I change the way formatting is checked switching from lb-format to pre-commit, similar to what was started in gaudi/Gaudi!1261 (merged), gaudi/Gaudi!1286 (merged) and Gauss!864 (merged). At the same time I update clang-format to version 16 and switch to black+isort for Python (see #42). I also moved flake8 checks from .gitlab-ci.yml to pre-commit.

I didn't include (yet) a full reformatting as it touches almost all files (because of a bug fix in the formatting logic) and we have too many MRs that would end up with conflicts.

Another thing that should be taken into account is that pre-commit relies on connections to remote Git repositories for the bootstrap. At the moment it tries to connect to github, so it fails on machines that cannot access github (like some of the LHCb private build machines), see gaudi/Gaudi#247. One option would be add mirrors on gitlab of the repositories we use (like those in https://gitlab.cern.ch/lhcb-core/mirrors).

This is a partial follow up on https://mattermost.web.cern.ch/lhcb/pl/umdze4wazjdq58pnr9dse9ezqa

Fixes #42

Edited by Marco Clemencic

Merge request reports