-
Notifications
You must be signed in to change notification settings - Fork 272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run clang-format on the repo, add a github action to check formatting #577
Conversation
Can you add instructions related to clang-cl under: I don't object to your change, but I don't want to have to explain to people contributed code that they need to use clang-cl. This needs to be documented. Otherwise it creates a lot of bureaucratic exchanges. Be mindful that not everyone uses clang-cl, so that's not entirely contributor friendly. (I personally do not object, to be clear.) |
Done. Note that the requirements are actually even a bit more strict: run a specific version of clang-format (currently stable version 17). This avoids inconsistent formatting. If you have any suggestion on making this smoother, I'm happy to take them onboard. |
@Dr-Emann Can you review? |
Might be worth a dockerfile with clang format installed, and a script that tries clang-format (checking the version), clang-format-17 and if neither work, using a docker container with the code mounted as a volume, to make it easier to format locally. |
Nice, yes using a bundled docker container sounds much nicer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should be able to merge this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally prefer a longer line length, but happy to have automated formatting, like they say about gofmt:
Gofmt's style is no one's favorite, yet gofmt is everyone's favorite.
This allows anyone to ignore the commit with: git blame --ignore-revs-file .git-blame-ignore-revs Or to always use the ignore-revs file: git config blame.ignoreRevsFile .git-blame-ignore-revs
The github action expects a .clang-format-ignore file in order to exclude files, so I've renamed it. It also expects the entries to match the full path as far as I can tell, so I've switched them to be regexes rather than plain filenames.
tools/clang-format.sh