You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ja...@apache.org on 2025/06/20 10:43:57 UTC
(mynewt-nimble) 01/03: ci: Add clang-format configuration file
This is an automated email from the ASF dual-hosted git repository.
janc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git
commit 4416e2b280b825e97932b6e2f6370e5309dad0cd
Author: Szymon Czapracki <sz...@codecoup.pl>
AuthorDate: Fri Jun 13 17:27:54 2025 +0200
ci: Add clang-format configuration file
Add the clang-format configuration file to the repository
to enforce consistent code formatting across the project.
---
.clang-format | 86 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 86 insertions(+)
diff --git a/.clang-format b/.clang-format
new file mode 100644
index 000000000..276f7fe43
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,86 @@
+# Use LLVM style as a base
+BasedOnStyle: LLVM
+
+# Indentation settings
+IndentWidth: 4
+UseTab: Never
+TabWidth: 10
+
+# Line length
+ColumnLimit: 79
+PenaltyExcessCharacter: 2
+
+# Braces placement
+BreakBeforeBraces: Custom
+BraceWrapping:
+ AfterClass: true
+ AfterControlStatement: false
+ AfterEnum: false
+ AfterFunction: true
+ AfterNamespace: true
+ AfterStruct: false
+ AfterUnion: false
+ BeforeCatch: false
+ BeforeElse: false
+ IndentBraces: false
+ SplitEmptyFunction: false
+ SplitEmptyRecord: false
+ SplitEmptyNamespace: false
+
+MacroBlockBegin: '(STATS_NAME_START|STATS_SECT_START)'
+MacroBlockEnd: '(STATS_NAME_END|STATS_SECT_END)'
+StatementMacros: ['SLIST_HEAD']
+
+ForEachMacros:
+ - 'SLIST_FOREACH'
+ - 'SLIST_FOREACH_FROM'
+ - 'SLIST_FOREACH_SAFE'
+ - 'SLIST_FOREACH_FROM_SAFE'
+ - 'SLIST_FOREACH_PREVPTR'
+ - 'STAILQ_FOREACH'
+ - 'STAILQ_FOREACH_FROM'
+ - 'STAILQ_FOREACH_SAFE'
+ - 'STAILQ_FOREACH_FROM_SAFE'
+ - 'LIST_FOREACH'
+ - 'LIST_FOREACH_FROM'
+ - 'LIST_FOREACH_SAFE'
+ - 'LIST_FOREACH_FROM_SAFE'
+ - 'TAILQ_FOREACH'
+ - 'TAILQ_FOREACH_FROM'
+ - 'TAILQ_FOREACH_SAFE'
+ - 'TAILQ_FOREACH_FROM_SAFE'
+ - 'TAILQ_FOREACH_REVERSE'
+ - 'TAILQ_FOREACH_REVERSE_FROM'
+ - 'TAILQ_FOREACH_REVERSE_SAFE'
+ - 'TAILQ_FOREACH_REVERSE_FROM_SAFE'
+
+# Pointer and reference alignment
+PointerAlignment: Right
+
+# Function declaration formatting
+AllowAllParametersOfDeclarationOnNextLine: false
+BinPackParameters: true
+BinPackArguments: true
+AlignAfterOpenBracket: Align
+AlignConsecutiveAssignments: false
+AlignConsecutiveDeclarations: false
+AlignConsecutiveMacros: true
+
+# Control statements
+AlwaysBreakAfterReturnType: TopLevelDefinitions
+AllowShortIfStatementsOnASingleLine: false
+AllowShortLoopsOnASingleLine: false
+AllowShortFunctionsOnASingleLine: InlineOnly
+AllowShortBlocksOnASingleLine: false
+AllowShortCaseLabelsOnASingleLine: false
+
+Cpp11BracedListStyle: false
+SpacesInParentheses: false
+SpaceAfterCStyleCast: false
+SpaceBeforeParens: ControlStatementsExceptControlMacros
+SpaceInEmptyParentheses: false
+
+AlignArrayOfStructures: Left
+SortIncludes: false
+DisableFormat: false
+InsertNewlineAtEOF: true