Use pre-commit for formatting and flake8 checks
This is a partial version of !4346 in the sense that it adds support for checking the formatting with pre-commit, but does not require a full reformatting (since clang-format-8 is now available for pre-commit).
This can be merged any time as it does not require file changes and the reformatting can happen another time (e.g. YETS).