Browse Source

Add Devilution specific config values for clang-format.

* AlignTrailingComments: true
* AllowShortBlocksOnASingleLine: true
* AllowShortFunctionsOnASingleLine: None
* PointerAlignment: Right

Note, currently, the format.sh script uses the config file
for .cpp files. The `AlignConsecutiveAssignments: true` setting
is specifically added for .h files.

I could not find a way to specify what config file to use
for clang-format. So, for now, the config file is used for
.cpp.
pull/25/head
Robin Eklind 8 years ago committed by Anders Jenbo
parent
commit
892e84136e
  1. 14
      .clang-format
  2. 2
      format.sh

14
.clang-format

@ -7,11 +7,11 @@ AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Right
AlignOperands: false
AlignTrailingComments: false
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortBlocksOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
@ -20,7 +20,7 @@ AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: MultiLine
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
@ -56,12 +56,12 @@ DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: false
ForEachMacros:
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Preserve
IncludeCategories:
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
@ -92,7 +92,7 @@ PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Left
PointerAlignment: Right
ReflowComments: true
SortIncludes: true
SortUsingDeclarations: true

2
format.sh

@ -4,7 +4,7 @@ CPP_DONE="Source/doom.cpp Source/movie.cpp Source/pfile.cpp Source/player.cpp So
for f in $CPP_DONE; do
echo "Formatting $f"
clang-format -style="{BasedOnStyle: webkit, AlignTrailingComments: true, AllowShortBlocksOnASingleLine: true, AllowShortFunctionsOnASingleLine: None, PointerAlignment: Right}" -i $f
clang-format -style=file -i $f
done
H_DONE="enums.h structs.h"

Loading…
Cancel
Save