clang-format-action
clang-format-action copied to clipboard
Allow applying corrections in place
This is helpful to show what would be necessary to change on the code to match the style
applying corrections in place
By this, do you mean that you're requesting that this action pushes a commit that formats the files failing the check? If so, I won't be implementing that - my intent for this action is to provide a minimal-permission checker utility, not a fixer utility.
I'm talking about running clang-format with -i or an option that would just show the necessary changes
So I guess the procedure here would be
- Run
clang-format -i - Output a diff of all files that have changed by this. Easiest approach might be a
git commit -am "Dummy"and thengit diff HEAD~1
So I guess the procedure here would be
- Run
clang-format -i- Output a diff of all files that have changed by this. Easiest approach might be a
git commit -am "Dummy"and thengit diff HEAD~1
This will not work I believe when the code is already formatted, because git commit -am "..." will not create a commit with empty diff. So the next cmd git diff HEAD~1 will not show the formatter diff, and instead show the previous normal commit diff.
Removing an extra step of creating a commit might work though:
git clang-format --diff -q origin/main
If the code is already formatted, the cmd returns an empty string, otherwise it will show the desired diff.