-
Notifications
You must be signed in to change notification settings - Fork 13
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
Add code-formatting hook #135
Comments
Thanks for the heads-up! I'm happy to support whatever decision you make, here. But it would certainly be a good idea to hold off implementing it until there's some more progress on the gtk4 branch! Getting close. For my thoughts, I'm not a big fan of these kinds of automated processes restricting commit, including linting and code formatting. For code, I find the best thing to do is lay down the standard (i.e. I always just pick 'PEP-8' when writing Python), have everyone understand they should make their best effort to meet it, and pick up any egregious deviations in the reviews. As long as the code is reasonably readable, I think that's the most important thing. I'm sure I'm a frequent offender for deviations, my apologies for that! I have learned so much about how to configure Emacs code formatting (yes, I'm one of those...) Have you documented the formatting standard anywhere, btw? Is it this: https://gstreamer.freedesktop.org/documentation/frequently-asked-questions/developing.html?gi-language=c#what-is-the-coding-style-for-gstreamer-code ? Pardon my ignorance, I've just been following the code around my changes, frankly... |
Having said all that, for any interested readers, I'm pretty sure that Emacs' LSP mode can make use of clang format definitions to reformat code as we type. So that could be handy, in any case. |
In the past I've been use gst-indent which is a wrapper around gnu indent. But I've seen that gstreamer is struggling a bit with some change in newer versions. But definitely not urgent. |
To ensure a consistent code formatting I would add a .clang-format config to git and also apply this once. I'd also add a pre-submit hook and will see if I can figure a github-action to verify it.
The config I am currently testing is based on:
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/340#note_2137606
simply put that into a .clang-format file in the repo-root and run e.g.
clang-format -i ./src/lib/core/sequence.c
and thenmeld ./src/lib/core/sequence.c
(or git diff).In the past I used gst-indent but given the woes in the above thread, switching to clang-format might be a better move.
This will likely cause conflicts for pending work, so we should coordinate the timing. It is by no means urgent.
@dlbeswick FYI, wrt. to gtk-4 branch.
Any thoughts?
The text was updated successfully, but these errors were encountered: