-
Notifications
You must be signed in to change notification settings - Fork 632
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
Setup and use clang-format as part of CI\CD #280
Comments
I can take a look at this, but I think the best way to implement this is in a pre-commit hook in git, instead of giving a workflow write access to the repo. It would be better if someone who is more familiar with the codebase can come up with the clang-format config though, since I don't know the codebase very well. Here's what I came up with and it's probably not good enough, it still makes a lot of changes that sacrifices readability for correctness:
|
Looks good as the first iteration input, but needs a exclusion rule for 3rd-party code, if such things are possible, otherwise we'll reformat stuff that is not ours. |
I'm fine with something like |
Looks like it is not possible to exclude individual files with clang-format, but excluding directories is possible. Which directories contain 3rd party stuff that we don't want to lint? |
Every subdirectory of |
That makes it easy, we just need to put some more config files in these directories to disable formatting. The config from the subdirectories have higher priority:
|
Manual code formatting is hard and there are almost always some inconsistencies and preferences, which are sometimes really hard to resolve. We are in luck though, because sometimes the resolution is simple: make a robot do formatting for you, then make that robot do it every time for every code change.
Result: everybody are about as equally pissed off, but at least the code looks consistent. Let's do it for this repo too.
The text was updated successfully, but these errors were encountered: