Skip to content

Commit f20adc7

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> chore: remove unwanted things Signed-off-by: saurabhraghuvanshii <saurabhsraghuvanshi@gmail.com> chore: increse line width Signed-off-by: saurabhraghuvanshii <saurabhsraghuvanshi@gmail.com>
1 parent f246109 commit f20adc7

File tree

2 files changed

+89
-0
lines changed

2 files changed

+89
-0
lines changed

.clang-format

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

.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)