From 3d2305809e37c446901ea477e065167c997bf54c Mon Sep 17 00:00:00 2001 From: user Date: Sat, 18 Jul 2026 20:57:37 +0200 Subject: hooks: clang-format pre-commit (changed lines only) + .clang-format Same setup as sl0pboy: git-clang-format scopes formatting to the lines each commit touches, re-adds the formatted files, and refuses partially-staged C files. Style file matches the house style (4-space, attached braces, 100 cols, short cases/ifs inline, no include sorting - order is load-bearing for SDCC userland). Enable once: git config core.hooksPath hooks --- .clang-format | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .clang-format (limited to '.clang-format') diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..e338db1 --- /dev/null +++ b/.clang-format @@ -0,0 +1,23 @@ +# House style for sl0pboy/gbos C: 4-space, attached braces, dense-but-readable. +# Tuned to minimize churn against the existing hand-formatted code. +BasedOnStyle: LLVM +IndentWidth: 4 +TabWidth: 4 +UseTab: Never +ColumnLimit: 100 +PointerAlignment: Right +BreakBeforeBraces: Attach +AllowShortCaseLabelsOnASingleLine: true +AllowShortFunctionsOnASingleLine: All +AllowShortIfStatementsOnASingleLine: AllIfsAndElse +AllowShortLoopsOnASingleLine: true +AllowShortBlocksOnASingleLine: Always +AlignTrailingComments: true +SpacesBeforeTrailingComments: 2 +AlignConsecutiveMacros: Consecutive +SortIncludes: Never +IndentCaseLabels: true +MaxEmptyLinesToKeep: 2 +KeepEmptyLinesAtTheStartOfBlocks: true +AlignArrayOfStructures: None +ReflowComments: false -- cgit v1.3.1-sl0p