[libcamera-devel] [PATCH] clang-format: Enable sorted includes

Kieran Bingham kieran.bingham at ideasonboard.com
Mon Feb 22 10:46:08 CET 2021


We aim to ensure that our includes are alphabetically sorted.  Whilst
checkstyle.py also handles this, enable the clang-format explicitly to
define the code-style requirement, and allow clang-format to also
correct un-sorted header includes.

Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>

---
I can't see why this isn't enabled, unless clang-format is sorting in a
manner which is incompatible with the implementation in our
checkstyle.py ?

Some initial testing shows that clang-format only sorts per block,
separated by newlines, which seems to match our implementation.


 .clang-format | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.clang-format b/.clang-format
index bef07cd84338..f5d9ba940eeb 100644
--- a/.clang-format
+++ b/.clang-format
@@ -97,7 +97,7 @@ PenaltyReturnTypeOnItsOwnLine: 60
 
 PointerAlignment: Right
 ReflowComments: false
-SortIncludes: false
+SortIncludes: true
 #SortUsingDeclarations: false # Unknown to clang-format-4.0
 SpaceAfterCStyleCast: false
 SpaceAfterTemplateKeyword: false
-- 
2.25.1



More information about the libcamera-devel mailing list