Skip to content

Instantly share code, notes, and snippets.

@CFSworks
Created March 15, 2018 04:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CFSworks/42be608c5ead2251542163e3b97b66b2 to your computer and use it in GitHub Desktop.
Save CFSworks/42be608c5ead2251542163e3b97b66b2 to your computer and use it in GitHub Desktop.
WIP Panda3D clang-format rules
# Indentation
UseTab: Never
IndentWidth: 2
ContinuationIndentWidth: 2
ConstructorInitializerIndentWidth: 2
# Spaces
SpaceAfterTemplateKeyword: false
#SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
# Alignment
AlignConsecutiveAssignments: true
#AlignConsecutiveDeclarations: true
AlignEscapedNewlines: Left
AlignOperands: true
PointerAlignment: Right
# Single-line
AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: true
# Inserting breaks
AlwaysBreakTemplateDeclarations: true
BreakConstructorInitializers: AfterColon
ConstructorInitializerAllOnOneLineOrOnePerLine: true
BreakBeforeBraces: Custom
BraceWrapping:
SplitEmptyFunction: false
# Continuation
IndentWrappedFunctionNames: true
BinPackParameters: true
# Penalties
PenaltyBreakBeforeFirstCallParameter: 1000
PenaltyReturnTypeOnItsOwnLine: 100
PenaltyBreakFirstLessLess: 0
PenaltyExcessCharacter: 3
# Includes
#IncludeBlocks: Regroup
IncludeIsMainRegex: "$"
IncludeCategories:
- Regex: 'pandabase.h'
Priority: -1
- Regex: 'dtoolbase.h'
Priority: -1
# Main header, priority 0
# #include "foo.h"
- Regex: '^"'
Priority: 1
# #include <foo.h>
- Regex: '^<'
Priority: 2
#!/bin/sh
set -euo pipefail
sed -i 's/\(PT\)(\([A-Za-z0-9_]*\))/\1__\2/g' $*
sed -i 's/PUBLISHED:/public:\/\/actuallypublished/' $*
clang-format -i $*
sed -i 's/public:.*actuallypublished/PUBLISHED:/' $*
sed -i 's/PT__\([A-Za-z0-9_]*\)/PT(\1)/g' $*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment