mp-units icon indicating copy to clipboard operation
mp-units copied to clipboard

Test/clang format

Open hofbi opened this issue 2 years ago • 6 comments

@mpusz This is a draft running the pre-commit check for clang format 15 in the CI. Right now the check fails, since I did not apply the changes so far.

The branch is based on #341, hence it should be merged after #341

hofbi avatar Mar 18 '22 17:03 hofbi

gitpod-io[bot] avatar Mar 18 '22 17:03 gitpod-io[bot]

I am not sure if we should require contributors to push correctly formatted files or should they be automatically formatted on push... The problem is that it will take a long time for clang-format-15 to be officially released and not everyone may have an access to use it today (i.e. on Windows).

mpusz avatar Mar 19 '22 19:03 mpusz

I will try to update the GitPod environment to include clang-format-15 so at least the contributors will be able to use the Gitpod environment with no issues.

mpusz avatar Mar 19 '22 19:03 mpusz

Right. I also thought about possible options here.

The ideal solution would be pre-commit.ci which is free for open source projects and contains a bit the pushes auto fixes if the ci fails. Unfortunately we cannot configure the environment here, so we have to wait until clang-format is officially released.

What I did locally to apply the format without causing conflicts with my actual clang-format was creating a docker image. But not sure if this can be nicely integrated with pre-commit. But users without clang-format 15 could at least format their code.

Or would it be make sense to provide clang-format 15 as Conan package?

hofbi avatar Mar 20 '22 01:03 hofbi

How should we proceed with clang-format?

I found that https://github.com/scop/pre-commit-shfmt/blob/main/.pre-commit-hooks.yaml#L11 use a docker image for running their shell formatter, so we could try to do a similar thing with clang-format. Maybe this is also interesting for other project using C++20

hofbi avatar Apr 01 '22 17:04 hofbi

Well, I am not sure. I care about clang-format much more than CMake, which I still find inferior to manually written scripts. clang-format gives more value so we should use it for sure. However, I do not want to raise the bar too high for contributors as they may not be able to use clang-format-15 for now.

At least GitPod is ready and everyone can use it to develop and format the code...

mpusz avatar Apr 02 '22 19:04 mpusz