Skip to content

Commit 1d52138

Browse files
authored
Formatting (#167)
1 parent db4173e commit 1d52138

File tree

12 files changed

+265
-131
lines changed

12 files changed

+265
-131
lines changed

.clang-format

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
AccessModifierOffset: -2
2+
AlignAfterOpenBracket: BlockIndent
3+
AlignConsecutiveAssignments: false
4+
AlignConsecutiveDeclarations: true
5+
AlignEscapedNewlines: Left
6+
AlignOperands: DontAlign
7+
AlignTrailingComments: false
8+
AllowAllArgumentsOnNextLine: false
9+
AllowAllParametersOfDeclarationOnNextLine: false
10+
AllowShortBlocksOnASingleLine: false
11+
AllowShortCaseLabelsOnASingleLine: false
12+
AllowShortFunctionsOnASingleLine: None
13+
AllowShortIfStatementsOnASingleLine: WithoutElse
14+
AllowShortLoopsOnASingleLine: false
15+
AlwaysBreakAfterDefinitionReturnType: None
16+
AlwaysBreakAfterReturnType: None
17+
AlwaysBreakBeforeMultilineStrings: true
18+
AlwaysBreakTemplateDeclarations: Yes
19+
BinPackArguments: false
20+
BinPackParameters: false
21+
BraceWrapping:
22+
AfterClass: false
23+
AfterControlStatement: false
24+
AfterEnum: false
25+
AfterFunction: false
26+
AfterNamespace: false
27+
AfterStruct: false
28+
AfterUnion: false
29+
AfterExternBlock: false
30+
BeforeCatch: false
31+
BeforeElse: false
32+
IndentBraces: false
33+
SplitEmptyFunction: false
34+
SplitEmptyRecord: false
35+
SplitEmptyNamespace: false
36+
BreakAfterJavaFieldAnnotations: false
37+
BreakBeforeBinaryOperators: None
38+
BreakBeforeBraces: Custom
39+
BreakBeforeInheritanceComma: false
40+
BreakBeforeTernaryOperators: true
41+
BreakConstructorInitializers: BeforeComma
42+
BreakConstructorInitializersBeforeComma: false
43+
BreakStringLiterals: true
44+
ColumnLimit: 80
45+
CompactNamespaces: false
46+
ConstructorInitializerAllOnOneLineOrOnePerLine: false
47+
ConstructorInitializerIndentWidth: 2
48+
ContinuationIndentWidth: 2
49+
Cpp11BracedListStyle: true
50+
DerivePointerAlignment: false
51+
DisableFormat: false
52+
ExperimentalAutoDetectBinPacking: false
53+
FixNamespaceComments: true
54+
IncludeBlocks: Preserve
55+
IncludeIsMainRegex: "(Test)?$"
56+
IndentCaseLabels: true
57+
IndentPPDirectives: AfterHash
58+
IndentWidth: 2
59+
IndentWrappedFunctionNames: false
60+
InsertBraces: true
61+
JavaScriptQuotes: Leave
62+
JavaScriptWrapImports: true
63+
KeepEmptyLinesAtTheStartOfBlocks: false
64+
MacroBlockBegin: ""
65+
MacroBlockEnd: ""
66+
MaxEmptyLinesToKeep: 1
67+
NamespaceIndentation: None
68+
PackConstructorInitializers: NextLine
69+
PenaltyBreakAssignment: 10
70+
PenaltyBreakBeforeFirstCallParameter: 30
71+
PenaltyBreakComment: 10
72+
PenaltyBreakFirstLessLess: 0
73+
PenaltyBreakString: 10
74+
PenaltyExcessCharacter: 400
75+
PenaltyReturnTypeOnItsOwnLine: 350
76+
PointerAlignment: Left
77+
ReflowComments: true
78+
RequiresClausePosition: OwnLine
79+
SortIncludes: false
80+
SortUsingDeclarations: true
81+
SpaceAfterCStyleCast: false
82+
SpaceAfterLogicalNot: false
83+
SpaceAfterTemplateKeyword: false
84+
SpaceBeforeAssignmentOperators: true
85+
SpaceBeforeCtorInitializerColon: true
86+
SpaceBeforeInheritanceColon: true
87+
SpaceBeforeParens: Never
88+
SpaceBeforeRangeBasedForLoopColon: true
89+
SpaceInEmptyParentheses: false
90+
SpacesBeforeTrailingComments: 1
91+
SpacesInAngles: Never
92+
SpacesInContainerLiterals: false
93+
SpacesInCStyleCastParentheses: false
94+
SpacesInParentheses: false
95+
SpacesInSquareBrackets: false
96+
SeparateDefinitionBlocks: Always
97+
Standard: Latest
98+
TabWidth: 2
99+
UseTab: ForContinuationAndIndentation

.github/workflows/main.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ concurrency:
1010
cancel-in-progress: true
1111

1212
jobs:
13+
formatting-check:
14+
name: Formatting Check
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v3
18+
- uses: jidicula/[email protected]
19+
with: { clang-format-version: "15" }
1320
build:
1421
runs-on: ubuntu-latest
1522
steps:

.vscode/settings.json

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,32 @@
11
{
22
"editor.formatOnSave": true,
3-
"lldb.launch.sourceMap": {
4-
"/proc/self/cwd": "${workspaceFolder}"
5-
},
63
"files.insertFinalNewline": true,
74
"files.eol": "\n",
85
"editor.insertSpaces": false,
6+
"files.associations": {},
7+
"editor.wordWrap": "wordWrapColumn",
8+
"C_Cpp.autocomplete": "default",
9+
"C_Cpp.autoAddFileAssociations": false,
910
"C_Cpp.default.compileCommands": "${workspaceFolder}/compile_commands.json",
10-
"C_Cpp.default.includePath": [
11-
"${default}",
12-
"external/ecsact_runtime",
13-
"external/ecsact_lang_cpp"
14-
]
11+
"lldb.launch.sourceMap": {
12+
"/proc/self/cwd": "${workspaceFolder}"
13+
},
14+
"[json]": {
15+
"editor.defaultFormatter": "vscode.json-language-features"
16+
},
17+
"[jsonc]": {
18+
"editor.defaultFormatter": "vscode.json-language-features"
19+
},
20+
"[markdown]": {
21+
"editor.defaultFormatter": "DavidAnson.vscode-markdownlint"
22+
},
23+
"[cpp]": {
24+
"editor.detectIndentation": false,
25+
"editor.defaultFormatter": "xaver.clang-format"
26+
},
27+
"[starlark]": {
28+
"editor.defaultFormatter": "BazelBuild.vscode-bazel",
29+
"editor.insertSpaces": true,
30+
"editor.detectIndentation": false
31+
}
1532
}

cli/cli.cc

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,15 @@ int main(int argc, char* argv[]) {
2828
{"config", &ecsact::cli::detail::config_command},
2929
};
3030

31-
for(int i=1; argc > i; ++i) {
32-
if(argv[i][0] == '-') continue;
31+
for(int i = 1; argc > i; ++i) {
32+
if(argv[i][0] == '-') {
33+
continue;
34+
}
3335

3436
std::string arg = argv[i];
35-
if(!commands.contains(arg)) continue;
37+
if(!commands.contains(arg)) {
38+
continue;
39+
}
3640

3741
return commands.at(arg)(argc, argv);
3842
}

0 commit comments

Comments
 (0)