Skip to content

Commit dedbe95

Browse files
feat: add .clang-format
Signed-off-by: saurabhraghuvanshii <saurabhsraghuvanshi@gmail.com> chore: update clang-format Signed-off-by: saurabhraghuvanshii <saurabhsraghuvanshi@gmail.com> feat: add clang-format.yaml for CI Signed-off-by: saurabhraghuvanshii <saurabhsraghuvanshi@gmail.com> chore: add clang-format checks for CI in build Signed-off-by: saurabhraghuvanshii <saurabhsraghuvanshi@gmail.com> chore: remove unwanted things Signed-off-by: saurabhraghuvanshii <saurabhsraghuvanshi@gmail.com> chore: addresses comments changes Signed-off-by: saurabhraghuvanshii <saurabhsraghuvanshi@gmail.com>
1 parent f246109 commit dedbe95

File tree

2 files changed

+97
-0
lines changed

2 files changed

+97
-0
lines changed

.clang-format

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
---
2+
3+
Language: Cpp
4+
BasedOnStyle: LLVM
5+
AccessModifierOffset: -4
6+
AlignAfterOpenBracket: DontAlign
7+
AlignEscapedNewlines: Left
8+
AlignTrailingComments: false
9+
AllowAllParametersOfDeclarationOnNextLine: true
10+
AllowShortCaseLabelsOnASingleLine: false
11+
AllowShortFunctionsOnASingleLine: All
12+
AllowShortIfStatementsOnASingleLine: false
13+
AllowShortLoopsOnASingleLine: false
14+
AlwaysBreakBeforeMultilineStrings: false
15+
AlwaysBreakTemplateDeclarations: No
16+
BinPackArguments: true
17+
BinPackParameters: true
18+
BraceWrapping:
19+
AfterClass: false
20+
AfterControlStatement: false
21+
AfterEnum: false
22+
AfterFunction: true
23+
AfterNamespace: false
24+
AfterObjCDeclaration: false
25+
AfterStruct: false
26+
AfterUnion: false
27+
BeforeCatch: false
28+
BeforeElse: false
29+
IndentBraces: false
30+
SplitEmptyFunction: true
31+
SplitEmptyRecord: true
32+
SplitEmptyNamespace: true
33+
BreakBeforeBinaryOperators: All
34+
BreakBeforeTernaryOperators: false
35+
BreakConstructorInitializers: BeforeComma
36+
BreakStringLiterals: true
37+
ColumnLimit: 0
38+
CommentPragmas: "suppress"
39+
CompactNamespaces: false
40+
ConstructorInitializerAllOnOneLineOrOnePerLine: false
41+
ConstructorInitializerIndentWidth: 4
42+
ContinuationIndentWidth: 4
43+
Cpp11BracedListStyle: false
44+
DerivePointerAlignment: false
45+
DisableFormat: false # this will help for using // clang-format off // clang-format on
46+
FixNamespaceComments: false
47+
# If this is needed or not
48+
# IncludeBlocks: Regroup
49+
IncludeCategories:
50+
- Regex: '^.*(precomp|pch|stdafx)'
51+
Priority: -1
52+
- Regex: '^".*"'
53+
Priority: 1
54+
- Regex: '^<.*>'
55+
Priority: 2
56+
- Regex: '.*'
57+
Priority: 3
58+
IndentCaseLabels: false
59+
IndentWidth: 4
60+
KeepEmptyLinesAtTheStartOfBlocks: false
61+
MacroBlockBegin: ''
62+
MacroBlockEnd: ''
63+
MaxEmptyLinesToKeep: 1
64+
NamespaceIndentation: All
65+
PointerAlignment: Right
66+
ReflowComments: false
67+
SortIncludes: true
68+
SpaceAfterTemplateKeyword: false
69+
SpaceInEmptyBlock : true
70+
SpaceInEmptyParentheses: false
71+
SpacesBeforeTrailingComments: 1
72+
SpacesInAngles: false
73+
SpacesInContainerLiterals: true
74+
SpacesInCStyleCastParentheses: false
75+
76+
---

.github/workflows/build.yaml

+21
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,27 @@ permissions:
1313
contents: read
1414

1515
jobs:
16+
clang-format-check:
17+
name: Clang Format Check
18+
runs-on: macos-15
19+
timeout-minutes: 10
20+
steps:
21+
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
22+
with:
23+
fetch-depth: 1
24+
25+
- name: Install Clang Format
26+
run: brew install clang-format
27+
28+
- name: Run Clang Format Check
29+
run: |
30+
git clang-format --diff --quiet
31+
if [ $? -ne 0 ]; then
32+
echo "ERROR: Code is not properly formatted."
33+
echo "Please run clang-format locally and commit the changes."
34+
exit 1
35+
fi
36+
1637
build:
1738
name: Build
1839
strategy:

0 commit comments

Comments
 (0)