Task #3736
closedCreate a .clang-format file to be able to auto-format C code
Description
It'd be great to set up a .clang-format config file to be able to auto-format C code with clang-format. Place it in the top-level project directory.
Background:
It would be nice to not having to think about spaces, placement of braces, etc mentioned in
https://redmine.openinfosecfoundation.org/projects/suricata/wiki/Coding_Style
The tool typically used to auto-format C-style code is clang-format, see also https://clang.llvm.org/docs/ClangFormat.html
Side note, clang-format does not enforce/change any naming conventions as listed in the Coding Style. As its name says, it's only about formatting. clang-tidy would be the tool for those things, as well as any potential linting for banned functions. That should be another task, though.
I will work on setting clang-format up for my changes anyways and don't mind making it available if there is any interest.
PS: Please note that this does not mean reformatting all C code as that would be quite disruptive. That should be another task/discussion as it will require planning if there is a willingness to do so. Also, I would recommend to never, ever combine formatting changes with any other changes in the same commit.
Updated by Roland Fischer over 4 years ago
Opened https://github.com/OISF/suricata/pull/5092 with clang-format config to open up discussion for bikeshedding and usefulness
Updated by Roland Fischer over 4 years ago
- Status changed from New to In Review
- Assignee set to Roland Fischer
Updated by Victor Julien about 4 years ago
- Status changed from In Review to Closed
- Priority changed from Low to Normal