Skip to content

Commit

Permalink
Add initial .clang-format
Browse files Browse the repository at this point in the history
Still a work in progress.
  • Loading branch information
pcolby committed Jan 4, 2025
1 parent e3e81de commit c96e1b2
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 0 deletions.
74 changes: 74 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
---
BasedOnStyle: WebKit
AlignAfterOpenBracket: DontAlign
AlignConsecutiveAssignments: None
AlignConsecutiveDeclarations: None
AlignConsecutiveMacros: true
AlignEscapedNewlines: LeftWithLastLine
AlignOperands: AlignAfterOperator
AlignTrailingComments: Always
AllowAllArgumentsOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: Always
AllowShortCompoundRequirementOnASingleLine: true
AllowShortIfStatementsOnASingleLine: true
AllowShortFunctionsOnASingleLine: false
AllowShortLoopsOnASingleLine: true
AlwaysBreakBeforeMultilineStrings: true
BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: false
AfterClass: true
AfterControlStatement: Never
AfterEnum: false
AfterFunction: true
AfterNamespace: false
AfterStruct: false
AfterUnion: false
BeforeElse: false
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false
BreakConstructorInitializers: AfterColon
ColumnLimit: 120
ContinuationIndentWidth: 4
Cpp11BracedListStyle: false
IncludeBlocks: Regroup
IncludeCategories:
- CaseSensitive: true
Priority: 2
Regex: _global\.h"$
SortPriority: 1
- CaseSensitive: false
Priority: 2
Regex: ^"
- CaseSensitive: true
Priority: 3
Regex: ^<qtpokit/
- CaseSensitive: true
Priority: 4
Regex: ^<Q
- CaseSensitive: false
Priority: 5
Regex: ^<
IndentPPDirectives: BeforeHash
IndentWidth: 4
LineEnding: LF
PackConstructorInitializers: NextLine
PointerAlignment: Right
PPIndentWidth: 2
QualifierAlignment: Left
SortUsingDeclarations: Lexicographic
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: false
SpaceAroundPointerQualifiers: Both
SpaceBeforeCpp11BracedList: true
SpacesInAngles: Never
Standard: Latest
UseTab: Never
#WrapNamespaceBodyWithEmptyLines: true \todo clang-format 20+
...
7 changes: 7 additions & 0 deletions .clang-format.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
for style in LLVM GNU Google Chromium Microsoft Mozilla WebKit; do
#for style in WebKit; do
#git checkout include src >& /dev/null
sed -i -Ee "s|^(BasedOnStyle:).*|\1 ${style}|" .clang-format
clang-format -i include/qtpokit/*.h src/*/*.{cpp,h}
printf "%-9s %5d\n" "${style}" "$(git diff | wc -l)"
done

0 comments on commit c96e1b2

Please sign in to comment.