Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

neatudarius
Copy link
Member

No description provided.

@neatudarius neatudarius force-pushed the neatudarius/ci/clang-format branch 3 times, most recently from 2a87954 to 4f9e99f Compare June 12, 2024 06:09
@@ -17,30 +37,30 @@ jobs:
matrix:
config:
- {
name: "Ubuntu Clang 17",
Copy link
Member Author

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.

@neatudarius neatudarius changed the title CI checks improvement: add clang-format check [WIP] CI checks improvement: add clang-format check Jun 12, 2024
Copy link
Member

@steve-downey steve-downey left a 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:
Copy link
Member

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?

Copy link
Member Author

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?

Copy link
Member

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.

.github/workflows/ci.yml Show resolved Hide resolved
- name: Install Clang Format
run: |
sudo apt-get update
sudo apt-get install clang-format
Copy link
Member

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.

@neatudarius neatudarius force-pushed the neatudarius/ci/clang-format branch 2 times, most recently from 18f92ef to 7753db4 Compare June 13, 2024 05:48
@neatudarius neatudarius force-pushed the neatudarius/ci/clang-format branch from 7753db4 to e55b6ec Compare June 13, 2024 05:55
@neatudarius
Copy link
Member Author

Do you have a yaml formatter that is good? The indent I missed in the config blocks irks me.

Check experimental commit 21a53d4

@neatudarius
Copy link
Member Author

work moved in #26

steve-downey added a commit that referenced this pull request Aug 12, 2024
Add constexpr to swap and emplace
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants