clang

发布时间 2023-12-12 20:30:46作者: hacker_dvd

.clang-tidy

Checks: >
  google-*,
  -*,
  modernize-*,
  clang-analyzer-*,
  performance-*,
  readability-*,
  -readability-magic-numbers,
  -modernize-use-trailing-return-type,
  -modernize-pass-by-value

CheckOptions:
  - key: readability-magic-numbers
    value: '0'
  - key: modernize-use-trailing-return-type
    value: '0'
  - key: modernize-pass-by-value
    value: '0'
  - key: readability-braces-around-statements.ShortStatementLines
    value: '1'
  - key: readability-function-size.BranchThreshold
    value: '4294967295'
  - key: readability-function-size.LineThreshold
    value: '4294967295'
  - key: readability-function-size.ParameterThreshold
    value: '4294967295'
  - key: readability-function-size.NestingThreshold
    value: '4294967295'
  - key: readability-function-size.VariableThreshold
    value: '4294967295'

WarningsAsErrors: ''
HeaderFilterRegex: '.*'
FormatStyle: 'google'

.clang-format

---
Language: Cpp
BasedOnStyle: Google

# Indentation
AccessModifierOffset: '-1'
NamespaceIndentation: All
ContinuationIndentWidth: 4
PointerAlignment: Left
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false

# Breaks
BreakBeforeBraces: Custom
BraceWrapping:
  AfterClass: true
  AfterControlStatement: false
  AfterEnum: true
  AfterFunction: true
  AfterNamespace: true
  AfterStruct: true
  AfterUnion: true
  AfterExternBlock: true
  BeforeCatch: true
  BeforeElse: true
  IndentBraces: false
ColumnLimit: 80

# Spaces
SpaceAfterCStyleCast: true
SpacesBeforeTrailingComments: 1
SpacesInParentheses: false
SpacesInAngles: false
SpacesInSquareBrackets: false

# Ordering
IncludeBlocks: Regroup
IncludeCategories:
  - Regex:           '^<ext/.*\.h>'
    Priority:        2
  - Regex:           '^<.*\.h>'
    Priority:        1
  - Regex:           '^".*\.h"'
    Priority:        -1
  - Regex:           '.*'
    Priority:        -2
SortIncludes: true

# Comments
ReflowComments: true

# Other
MaxEmptyLinesToKeep: 1
KeepEmptyLinesAtTheStartOfBlocks: false
...