feat: Projektstruktur nach P1204R0
Layout, Build und Konventionen analog zu mydb und cxx_scaffold_cli: Header und Quellen nebeneinander in playground/, Unit-Tests als .test.c/.test.cpp daneben, Integrationstests in tests/. Geruest-Module counter (C, Unity) und notebook (C++, doctest) zeigen jede Regel einmal an lauffaehigem Code. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
# House style. Byte-identical to the .clang-format already committed in PaulDB
|
||||
# and tui-framework -- this file is the source of truth, not a new invention.
|
||||
#
|
||||
# Requires clang-format >= 19: BreakAfterReturnType was renamed from
|
||||
# AlwaysBreakAfterReturnType in 19. Ubuntu 24.04 ships 18 and will REJECT this
|
||||
# file -- install LLVM from apt.llvm.org there.
|
||||
BasedOnStyle: LLVM
|
||||
PointerAlignment: Left
|
||||
ReferenceAlignment: Left
|
||||
ColumnLimit: 100
|
||||
BreakAfterReturnType: All
|
||||
BinPackParameters: false
|
||||
IndentWidth: 4
|
||||
TabWidth: 4
|
||||
UseTab: Never
|
||||
ContinuationIndentWidth: 4
|
||||
BreakBeforeBraces: Allman
|
||||
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||
SpaceAfterCStyleCast: true
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesInParentheses: false
|
||||
SpacesInSquareBrackets: false
|
||||
AllowShortIfStatementsOnASingleLine: WithoutElse
|
||||
SortIncludes: CaseSensitive
|
||||
IncludeBlocks: Regroup
|
||||
AllowShortFunctionsOnASingleLine: Empty
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
ReflowComments: true
|
||||
|
||||
# Zusatz gegenueber der PaulDB-Fassung: ohne das rueckt clang-format den
|
||||
# gesamten Inhalt eines extern "C"-Blocks um 4 ein. Da jeder C-Header hier fuer
|
||||
# die C++-Seite einen solchen Block hat, waere das die Mehrheit jeder Datei.
|
||||
IndentExternBlock: NoIndent
|
||||
|
||||
# LLVM setzt -2, was zu IndentWidth 2 passt. Bei IndentWidth 4 landen public:
|
||||
# und private: sonst zwei Spalten eingerueckt statt buendig mit der Klammer.
|
||||
AccessModifierOffset: -4
|
||||
|
||||
# Damit clang-format bei page.test.c erkennt, dass <mydb/page.h> der
|
||||
# Hauptheader ist und ihn nach ganz oben in einen eigenen Block sortiert.
|
||||
# Der Vorgabewert kennt nur die Formen foo_test.c und foo-test.c, nicht die
|
||||
# P1204-Form foo.test.c.
|
||||
IncludeIsMainRegex: '(\.test)?$'
|
||||
|
||||
# Include ordering, so that Regroup has a policy to apply.
|
||||
# P1204R0: own headers are included as <mydb/foo.h>, never "foo.h".
|
||||
IncludeCategories:
|
||||
# Own project headers first.
|
||||
- Regex: '^<mydb/'
|
||||
Priority: 1
|
||||
# Vendored test frameworks.
|
||||
- Regex: '^<(unity|doctest)'
|
||||
Priority: 2
|
||||
# C standard library.
|
||||
- Regex: '^<(assert|ctype|errno|inttypes|limits|stdalign|stdarg|stdbool|stddef|stdint|stdio|stdlib|string|time)\.h>$'
|
||||
Priority: 3
|
||||
# C++ standard library (extensionless).
|
||||
- Regex: '^<[a-z_]+>$'
|
||||
Priority: 4
|
||||
# Everything else (system, third-party).
|
||||
- Regex: '.*'
|
||||
Priority: 5
|
||||
Reference in New Issue
Block a user