It is quite confusing to newcomers that the formatting check gets mostly ignored. To fix that, enforce the formatting for new file and already formatted files, but ignore it for any files that aren't formatted already. We ignore the tests for now, since almost no test is formatted currently, and they are changed almost never.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
From a personal perspective I'm very unhappy with this patch, I really would like to use clang-format in most (all) of our code. From I libc++ developer perspective I agree we need to do this. I think more people need to have a look at it, therefore I will leave the final approval to others.
libcxx/utils/generate_ignore_format.sh | ||
---|---|---|
3 | This file needs a shebang and I would like comment what it does. |
I think we all agree that we want clang-format for all of our code. The problem now is that it is not the case at the moment. And the format CI is always failing and everyone ignores it. I think this patch at least is a step forward to enforce the formatting. However, this is still very challenging as people have different versions of clang-format. I wonder if we could
Let's do this. We've been living in this transitional state for long enough.
libcxx/utils/ci/run-buildbot | ||
---|---|---|
193 | It would be nice if check-generated-output failed when we format a file but we forget to update ignore_format.txt. This can be done by reusing the libcxx/utils/generate_ignore_format.sh script you already have. |
LGTM, but let's also update the documentation at https://libcxx.llvm.org/Contributing.html to mention that new files need to be run through clang-format.
libcxx/utils/ci/run-buildbot | ||
---|---|---|
218 |
We are waiting for the Docker image to be updated to clang-format 16 before we ship this.
sort doesn't sort consistently between distros, so I guess we have to just apply the patch from the CI.
I think that can be fixed by using a hard-coded locale. See D144126 (I actually noticed it while working on that patch.)
It would be nice if check-generated-output failed when we format a file but we forget to update ignore_format.txt. This can be done by reusing the libcxx/utils/generate_ignore_format.sh script you already have.