-
Notifications
You must be signed in to change notification settings - Fork 13
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
[WIP] CI checks improvement: add clang-format check #7
Conversation
2a87954
to
4f9e99f
Compare
@@ -17,30 +37,30 @@ jobs: | |||
matrix: | |||
config: | |||
- { | |||
name: "Ubuntu Clang 17", |
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.
For consistency with other blocks in the file.
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.
Notes
Generally looks good.
Do you have a yaml formatter that is good? The indent I missed in the config blocks irks me.
@@ -7,6 +7,26 @@ on: | |||
branches: [ main ] | |||
|
|||
jobs: | |||
lint: |
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.
This https://cpp-linter.github.io/cpp-linter-action/ might be a friendlier linter interface?
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.
I tried your suggestion. I couldn't make it work and also it uses clang-12 https://github.com/beman-project/Optional26/actions/runs/9494415629/job/26164716972 :( .
I was also thinking about an market Git action, but then I realized this doesn't help me to apply changes locally. Do you think it's better to have a script (e.g., lint-all.sh
- cpp, sh, md, yaml etc) and be able to run locally and from github workflow?
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.
I'm talking with some other developers locally about how they handle this for public github projects. We have a much nicer internal workflow tool, of course.
The weak consensus seems to be that for clang-format it's hard to justify a separate action that needs to build a docker image, and it's better to get the clang-format that you want, and then apply something like https://github.com/bloomberg/blazingmq/blob/d3bf9637db34a91455c9d83354c4844c178c3f1e/.github/workflows/formatting-check.yaml#L22
run: |
git clang-format-14 --diff -q origin/main | tee format_diff.txt
if [ -s format_diff.txt ]; then exit 1; fi
Which is hard coded to clang-format-14 which is so ancient it may not understand C++ anymore. But we've already got some infrastructure for getting LLVM current added.
clang-tidy may be more complicated, since it often needs review to confirm applicability? One suggestion has been
https://github.com/marketplace/actions/clang-tidy-review
Which does allow current clang-tidy to be used.
Making anything we do in automated checks something that can be straightforwardly done locally is important to me, as well. There's little as frustrating as finding out 30 minutes later that you've done something that would have been trivial to fix as you were coding it. Shifting left in the business process vernacular.
- name: Install Clang Format | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install clang-format |
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.
clang-format gets stale fast for contemporary C++, we should make sure we're getting a current one.
18f92ef
to
7753db4
Compare
7753db4
to
e55b6ec
Compare
Check experimental commit 21a53d4 |
work moved in #26 |
Add constexpr to swap and emplace
No description provided.