Skip to content

Commit

Permalink
Add pre-commit so CI integration does auto fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dantti committed Sep 15, 2023
1 parent 13b8c85 commit 7311b8b
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 50 deletions.
104 changes: 54 additions & 50 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,50 +1,51 @@
# .clang-format for Cutelyst projects 2023-04-18
# .clang-format for Cutelyst projects 2023-09-15
# Tries to be close to Qt coding style
# but meh for ASql lambdas which LambdaBodyIndentation ins't enough
---
Language: Cpp
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveMacros: 'false'
AlignConsecutiveAssignments: 'true'
AlignConsecutiveDeclarations: 'false'
AllowShortEnumsOnASingleLine: 'true'
AlignConsecutiveMacros: false
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: false
AllowShortEnumsOnASingleLine: true
AlignEscapedNewlines: DontAlign
AlignOperands: 'true'
AlignTrailingComments: 'true'
AllowAllArgumentsOnNextLine: 'true'
AllowAllParametersOfDeclarationOnNextLine: 'false'
AllowShortBlocksOnASingleLine: 'false'
AllowShortCaseLabelsOnASingleLine: 'false'
AllowShortFunctionsOnASingleLine: Inline
AlignOperands: true
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: InlineOnly
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: Inline
AllowShortLoopsOnASingleLine: 'false'
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: 'false'
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: 'Yes'
BinPackArguments: 'false'
BinPackParameters: 'false'
BinPackArguments: false
BinPackParameters: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: 'true'
AfterClass: 'true'
AfterEnum: 'false'
AfterCaseLabel: true
AfterClass: true
AfterEnum: false
AfterFunction: true
SplitEmptyFunction: 'true'
SplitEmptyRecord: 'true'
SplitEmptyNamespace: 'true'
BreakBeforeTernaryOperators: 'true'
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeComma
BreakInheritanceList: BeforeComma
BreakStringLiterals: 'true'
CompactNamespaces: 'false'
ConstructorInitializerAllOnOneLineOrOnePerLine: 'false'
BreakStringLiterals: true
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: '4'
ContinuationIndentWidth: '4'
ColumnLimit: 100
Cpp11BracedListStyle: 'true'
FixNamespaceComments: 'true'
Cpp11BracedListStyle: true
FixNamespaceComments: true
ForEachMacros:
- forever # avoids { wrapped to next line
- foreach
Expand All @@ -54,34 +55,33 @@ IncludeCategories:
- Regex: '^<Q.*'
Priority: 200
IncludeBlocks: Regroup
IndentAccessModifiers: 'false'
IndentCaseLabels: 'false'
IndentAccessModifiers: false
IndentCaseLabels: false
IndentPPDirectives: AfterHash
IndentWidth: '4'
IndentWrappedFunctionNames: 'true'
KeepEmptyLinesAtTheStartOfBlocks: 'true'
Language: Cpp
IndentWrappedFunctionNames: true
KeepEmptyLinesAtTheStartOfBlocks: true
LambdaBodyIndentation: OuterScope
NamespaceIndentation: None
PointerAlignment: Right
ReflowComments: 'true'
SortIncludes: 'true'
SortUsingDeclarations: 'false'
SpaceAfterCStyleCast: 'true'
SpaceAfterLogicalNot: 'false'
SpaceAfterTemplateKeyword: 'true'
SpaceBeforeAssignmentOperators: 'true'
SpaceBeforeCpp11BracedList: 'false'
SpaceBeforeCtorInitializerColon: 'true'
SpaceBeforeInheritanceColon: 'true'
ReflowComments: true
SortIncludes: true
SortUsingDeclarations: false
SpaceAfterCStyleCast: true
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: 'true'
SpaceInEmptyParentheses: 'false'
SpacesInAngles: 'false'
SpacesInCStyleCastParentheses: 'false'
SpacesInContainerLiterals: 'false'
SpacesInParentheses: 'false'
SpacesInSquareBrackets: 'false'
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
StatementMacros:
- Q_UNUSED
Expand All @@ -90,4 +90,8 @@ WhitespaceSensitiveMacros:
- C_ATTR
UseTab: Never

---
Language: Json
BasedOnStyle: llvm

...
13 changes: 13 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
exclude: ^(cmake/)
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v16.0.6
hooks:
- id: clang-format

0 comments on commit 7311b8b

Please sign in to comment.