-
Notifications
You must be signed in to change notification settings - Fork 13
Improving clang formatting #203
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
Conversation
… formatting of single files
…space in .clang-format
jgalan
left a comment
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.
As I commented to @lobis it would be interesting that our Cmake system forces that reformat-clang.sh is executed at the beginning of each make execution. So that any user that launches code compilation keeps a good formatting.
It could be nice but maybe it would give problems, also it takes a fair amount of time to execute the clang-format. It would be annoying for users such as me that have this done automatically on file save. I think it may be better a step on the pipeline that gives error if the source files have not been clang-formatted? (calculating the diff etc.). |
|
Perhaps would be better to use a pre-commit hook https://stackoverflow.com/questions/55965712/how-do-i-add-clang-formatting-to-pre-commit-hook |
It is not possible to implement it in the repo, at most you can have a file in the repo and direct users to copy this file into their |
Can this be done at the build or in the cmake? Or this is an overkill? Also note that you need |
|
I have added a Please, check again. |
…into clang-script
Script
reformat-clanghas been improved:readlinkto make the script independent from the path where is launched*.h,*.cxx,*.ccand*.CAdded
githookin thecmake, so theclang-formatis performed whengit commitis issuedgithookis created whencmakeis issued and if there is nopre-commitpresent.clang-formatis present in the system, otherwise is skipped.githookfeatures.