Skip to content

Use clang-format - #633

Merged
dinosaure merged 4 commits into
mainfrom
format
Mar 31, 2026
Merged

Use clang-format#633
dinosaure merged 4 commits into
mainfrom
format

Conversation

@dinosaure

Copy link
Copy Markdown
Collaborator

On top of #632, this PR introduce a new GitHub action which verifies that we respect a certain way to write our code. I also applied clang-format on the full codebase which generates a huge diff. I really tried to limit the diff and tweak a bit clang-format. We have two rules: format which calls clang-format -i and format-check which is used by our CI. I also completed the clean rules into the bindings/ directory to delete noexecstack.{c,h,s}.

@dinosaure
dinosaure force-pushed the format branch 2 times, most recently from 856e5ba to fde1eda Compare March 9, 2026 08:34
@hannesm

hannesm commented Mar 9, 2026

Copy link
Copy Markdown
Contributor

I'm not against a formatter, but suggest (a) to add it to .git-blame-ignore-revs, and (b) run it in CI as something that pushes to a PR.

I appreciate the work and the CI job, but I find it much nicer to not bother a contributor to act on some formatting issues. I understand that e.g. dnsvizor/mollymawk have such a CI job which unfortunately at the moment only works for branches of the original repository (not on forks). Maybe this is already the case here?

@dinosaure dinosaure closed this Mar 29, 2026
@dinosaure dinosaure reopened this Mar 29, 2026
@dinosaure
dinosaure force-pushed the format branch 4 times, most recently from 8ee1003 to 390d885 Compare March 29, 2026 15:44
@dinosaure dinosaure mentioned this pull request Mar 29, 2026
@dinosaure

Copy link
Copy Markdown
Collaborator Author

I’ve added the .git-blame-ignore-revs file. As for CI, the first thing is that I haven’t found a satisfactory CI solution that allows me to create a commit applying clang-format, and I’m not keen on using a GitHub Action that isn’t really well maintained.

So I’ve created a new PR that adds docs/contributing.md (see #634), which explains how to apply clang-format and that contributors should add the relevant commit to the .git-blame-ignore-revs file.

I tried to keep the diff as minimal as possible, but not only were quite a few files imported, and the question of style is often very subjective. So I tried to achieve a configuration that was roughly consistent with what I could see in the code.

@hannesm

hannesm commented Mar 31, 2026

Copy link
Copy Markdown
Contributor

cool. the ci check action is already a great thing so we don't end up with unformatted code.

If you're happy with this, please feel free to merge.

@dinosaure
dinosaure merged commit a333cbb into main Mar 31, 2026
20 checks passed
@dinosaure
dinosaure deleted the format branch March 31, 2026 09:30
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