Skip to content

Commit

Permalink
use clang-format (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
Zbizu authored Dec 5, 2023
2 parents 61df85c + 09c5cd8 commit 648509f
Show file tree
Hide file tree
Showing 209 changed files with 18,195 additions and 17,625 deletions.
141 changes: 141 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
---
Language: Cpp
#BasedOnStyle: WebKit
AccessModifierOffset: -4
AlignAfterOpenBracket: BlockIndent
AlignConsecutiveMacros: false
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Right
AlignOperands: false
AlignTrailingComments: false
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: MultiLine
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: true
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: All
BreakBeforeBraces: Attach
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: AfterColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 0
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: false
DeriveLineEnding: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: false
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 3
SortPriority: 0
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 2
SortPriority: 0
- Regex: '.*'
Priority: 1
SortPriority: 0
IncludeIsMainRegex: '(Test)?$'
IncludeIsMainSourceRegex: ''
#IndentAccessModifiers: true
IndentCaseLabels: true
IndentGotoLabels: true
IndentPPDirectives: BeforeHash
IndentWidth: 4
IndentWrappedFunctionNames: false
InsertBraces: true
InsertNewlineAtEOF: true
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
LambdaBodyIndentation: Signature
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: All
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 4
ObjCSpaceAfterProperty: true
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Left
QualifierAlignment: Left
ReferenceAlignment: Left
ReflowComments: true
RemoveBracesLLVM: false
SortIncludes: false
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: true
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyBlock: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInConditionalStatement: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpaceBeforeSquareBrackets: false
Standard: Latest
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 4
UseCRLF: false
UseTab: true
28 changes: 28 additions & 0 deletions .github/workflows/clang-format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Check code style

on:
push:
branches:
- master
- v*

paths:
- .clang-format
- src/**

pull_request:
paths:
- .clang-format
- src/**

jobs:
check-format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Install dependencies
run: sudo apt update -q && sudo apt install -yq clang-format

- name: Check code style
run: clang-format -n -style=file --Werror src/*.{cpp,h}
28 changes: 14 additions & 14 deletions data/1098/grounds.xml
Original file line number Diff line number Diff line change
Expand Up @@ -953,7 +953,7 @@
<replace_border id="22" edge="cse" with="5638"/>
</actions>
</specific>

<specific>
<conditions>
<match_border id="21" edge="n"/>
Expand All @@ -963,7 +963,7 @@
<replace_border id="22" edge="cne" with="5684"/>
</actions>
</specific>

<specific>
<conditions>
<match_border id="21" edge="s"/>
Expand All @@ -973,7 +973,7 @@
<replace_border id="22" edge="csw" with="5638"/>
</actions>
</specific>

<specific>
<conditions>
<match_border id="21" edge="n"/>
Expand All @@ -983,7 +983,7 @@
<replace_border id="22" edge="cnw" with="5683"/>
</actions>
</specific>

<specific>
<conditions>
<match_border id="21" edge="e"/>
Expand All @@ -993,7 +993,7 @@
<replace_border id="22" edge="cse" with="5637"/>
</actions>
</specific>

<specific>
<conditions>
<match_border id="21" edge="w"/>
Expand All @@ -1003,7 +1003,7 @@
<replace_border id="22" edge="csw" with="5686"/>
</actions>
</specific>

<specific>
<conditions>
<match_border id="21" edge="e"/>
Expand All @@ -1013,7 +1013,7 @@
<replace_border id="22" edge="cne" with="5637"/>
</actions>
</specific>

<specific>
<conditions>
<match_border id="21" edge="w"/>
Expand All @@ -1035,7 +1035,7 @@
<replace_border id="22" edge="cse" with="5638"/>
</actions>
</specific>

<specific>
<conditions>
<match_border id="21" edge="n"/>
Expand All @@ -1045,7 +1045,7 @@
<replace_border id="22" edge="cne" with="5684"/>
</actions>
</specific>

<specific>
<conditions>
<match_border id="21" edge="s"/>
Expand All @@ -1055,7 +1055,7 @@
<replace_border id="22" edge="csw" with="5638"/>
</actions>
</specific>

<specific>
<conditions>
<match_border id="21" edge="n"/>
Expand All @@ -1065,7 +1065,7 @@
<replace_border id="22" edge="cnw" with="5683"/>
</actions>
</specific>

<specific>
<conditions>
<match_border id="21" edge="e"/>
Expand All @@ -1075,7 +1075,7 @@
<replace_border id="22" edge="cse" with="5637"/>
</actions>
</specific>

<specific>
<conditions>
<match_border id="21" edge="w"/>
Expand All @@ -1085,7 +1085,7 @@
<replace_border id="22" edge="csw" with="5686"/>
</actions>
</specific>

<specific>
<conditions>
<match_border id="21" edge="e"/>
Expand All @@ -1095,7 +1095,7 @@
<replace_border id="22" edge="cne" with="5637"/>
</actions>
</specific>

<specific>
<conditions>
<match_border id="21" edge="w"/>
Expand Down
10 changes: 5 additions & 5 deletions data/760/collections.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<item id="1335"/>
<item id="2247"/>
<item id="2248"/>
<brush name="dragon skeleton"/>
<brush name="dragon skeleton"/>
<item id="1336"/>
<brush name="small mountain rocks"/>
<brush name="cave rocks"/>
Expand All @@ -66,7 +66,7 @@
<brush name="moldy brown mushroom large"/>
<brush name="slime table mushroom"/>
<brush name="small mushroom"/>
<brush name="mossy spots"/>
<brush name="mossy spots"/>
<item id="1481"/>
<brush name="blood"/>
<brush name="bloodwall"/>
Expand All @@ -89,7 +89,7 @@
<item id="3104"/>
</collections>
</tileset>

<tileset name="Desert">
<collections>
<brush name="sea"/>
Expand Down Expand Up @@ -240,7 +240,7 @@
<item fromid="1421" toid="1426"/>
</collections>
</tileset>

<tileset name="Jungle">
<collections>
<brush name="sea"/>
Expand Down Expand Up @@ -343,4 +343,4 @@
<brush name="wooden bars_2"/>
</collections>
</tileset>
</materials>
</materials>
2 changes: 1 addition & 1 deletion data/760/walls.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1841,7 +1841,7 @@
<item id="3524" chance="100"/>
</alternate>
</brush>

<tileset name="Walls">
<terrain>
<brush name="mountain wall"/>
Expand Down
8 changes: 4 additions & 4 deletions data/800/borders.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
1-55: 7.0 - 7.6
56-95: 7.8 - 8.0
-->

<!-- retro cave wall brown -->
<border id="1">
<borderitem edge="n" item="357"/>
Expand Down Expand Up @@ -498,7 +498,7 @@
<borderitem edge="dnw" item="4639"/>
<borderitem edge="dne" item="4638"/>
</border>

<!-- sea -->
<border id="42">
<borderitem edge="n" item="4644"/>
Expand Down Expand Up @@ -1118,7 +1118,7 @@
<borderitem edge="cse" item="6933"/>
<borderitem edge="csw" item="6930"/>
</border>

<!-- mountain border snow -->
<border id="90">
<borderitem edge="s" item="6941"/>
Expand Down Expand Up @@ -1150,7 +1150,7 @@
<borderitem edge="cse" item="7074"/>
<borderitem edge="csw" item="7073"/>
</border>

<!-- gray mud hard border -->
<border id="92">
<borderitem edge="s" item="7081"/>
Expand Down
Loading

0 comments on commit 648509f

Please sign in to comment.