Project

General

Profile

Actions

Task #3736

closed

Create a .clang-format file to be able to auto-format C code

Added by Roland Fischer over 4 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Normal
Target version:
-
Effort:
low
Difficulty:
low
Label:
Beginner

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.

Actions #1

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

Actions #2

Updated by Roland Fischer over 4 years ago

  • Status changed from New to In Review
  • Assignee set to Roland Fischer
Actions #3

Updated by Victor Julien about 4 years ago

  • Status changed from In Review to Closed
  • Priority changed from Low to Normal
Actions

Also available in: Atom PDF