-
Notifications
You must be signed in to change notification settings - Fork 504
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
Automatic code formatting #1104
Comments
Push a patch to gerrithub and let's talk. |
I uploaded the commits for that for review- https://review.gerrithub.io/q/topic:clang-format Note that for the commit- https://review.gerrithub.io/c/ffilz/nfs-ganesha/+/1187343, checkpatch has many warnings and errors I added a commit that changes the pre-commit hooks to verify the clang-format. We can also add to gerrit a clang-format verifier instead of the existing checkpath. If that will be accepted I'll also update the documentation regarding clang-format instead of checkpatch.pl. |
please resolve the conflict files on gerrit. |
This will require a re-submit when we are ready to merge it. We're not quite ready, but soon... |
Background
NFS-Ganesha is embracing the Kernel coding style and the checkpatch.pl to verify commit style.
The suggestion here is to stick with the existing coding style that Ganesha chose while integrating with
clang-format
for automatic code formatting.We do that internally and that saves us a lot of development time from dealing with code formatting.
We can take the kernel
.clang-format
configuration file from- https://github.com/torvalds/linux/blob/master/.clang-format place it in the Ganesha root and run a one-time phase to format all the existing code (find . -iname *.h -o -iname *.c | xargs clang-format -i
).I tried it locally and there are many changes but they are not massive.
We can configure the pre-commit hook to verify that the formatting doesn't violate the clang-format configuration, similar to what
checkpatch.pl
is doing, just that it will be much easier to fix.We can also configure
git-blame
to ignore the commit that does the reformatting (https://docs.github.com/en/repositories/working-with-files/using-files/viewing-a-file#ignore-commits-in-the-blame-view)@ffilz WDYT?, we'd be happy to contribute that from what we do internally if the community has interest in it.
The text was updated successfully, but these errors were encountered: