tutorial: volume, clang-format and clang-tidy
This commit is contained in:
parent
6772c7bfc8
commit
33a11f7d1f
|
@ -0,0 +1,135 @@
|
|||
---
|
||||
Language: Cpp
|
||||
# BasedOnStyle: LLVM
|
||||
# https://clang.llvm.org/docs/ClangFormatStyleOptions.html
|
||||
# compare against `clang-format --style=webkit -dump-config > .clang-format`
|
||||
AccessModifierOffset: -4
|
||||
AlignAfterOpenBracket: AlwaysBreak
|
||||
AlignConsecutiveAssignments: Consecutive
|
||||
AlignConsecutiveBitFields: Consecutive
|
||||
AlignConsecutiveDeclarations: false
|
||||
AlignConsecutiveMacros: Consecutive
|
||||
AlignEscapedNewlines: Left
|
||||
AlignOperands: DontAlign
|
||||
AlignTrailingComments: true
|
||||
AllowAllArgumentsOnNextLine: true
|
||||
AllowAllParametersOfDeclarationOnNextLine: true
|
||||
AllowShortBlocksOnASingleLine: false
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
AllowShortEnumsOnASingleLine: false
|
||||
AllowShortFunctionsOnASingleLine: None
|
||||
AllowShortIfStatementsOnASingleLine: false
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AlwaysBreakAfterDefinitionReturnType: None
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: false
|
||||
AlwaysBreakTemplateDeclarations: MultiLine
|
||||
BinPackArguments: false
|
||||
BitFieldColonSpacing: Both
|
||||
BinPackParameters: false
|
||||
BraceWrapping:
|
||||
AfterClass: true
|
||||
AfterControlStatement: true
|
||||
AfterEnum: true
|
||||
AfterFunction: true
|
||||
AfterNamespace: false
|
||||
AfterObjCDeclaration: false
|
||||
AfterStruct: true
|
||||
AfterUnion: true
|
||||
BeforeCatch: true
|
||||
BeforeElse: true
|
||||
IndentBraces: false
|
||||
SplitEmptyFunction: true
|
||||
SplitEmptyRecord: true
|
||||
SplitEmptyNamespace: true
|
||||
AfterExternBlock: false
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeBraces: Custom
|
||||
BreakBeforeInheritanceComma: false
|
||||
BreakInheritanceList: BeforeComma
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakConstructorInitializersBeforeComma: true
|
||||
BreakConstructorInitializers: BeforeComma
|
||||
BreakAfterJavaFieldAnnotations: false
|
||||
BreakStringLiterals: true
|
||||
ColumnLimit: 120
|
||||
CommentPragmas: '^ IWYU pragma:'
|
||||
CompactNamespaces: false
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
||||
ConstructorInitializerIndentWidth: 4
|
||||
ContinuationIndentWidth: 4
|
||||
Cpp11BracedListStyle: 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: 2
|
||||
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
|
||||
Priority: 3
|
||||
- Regex: '.*'
|
||||
Priority: 1
|
||||
IncludeIsMainRegex: '(Test)?$'
|
||||
IndentCaseLabels: true
|
||||
IndentExternBlock: false
|
||||
IndentWidth: 4
|
||||
IndentWrappedFunctionNames: false
|
||||
JavaScriptQuotes: Leave
|
||||
JavaScriptWrapImports: true
|
||||
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||
MacroBlockBegin: ''
|
||||
MacroBlockEnd: ''
|
||||
MaxEmptyLinesToKeep: 1
|
||||
NamespaceIndentation: All
|
||||
ObjCBinPackProtocolList: Auto
|
||||
ObjCBlockIndentWidth: 2
|
||||
ObjCSpaceAfterProperty: false
|
||||
ObjCSpaceBeforeProtocolList: true
|
||||
PenaltyBreakAssignment: 350
|
||||
PenaltyBreakBeforeFirstCallParameter: 20
|
||||
PenaltyBreakComment: 300 # 100
|
||||
PenaltyBreakFirstLessLess: 120
|
||||
PenaltyBreakString: 1000
|
||||
PenaltyBreakTemplateDeclaration: 10
|
||||
PenaltyExcessCharacter: 1000000
|
||||
PenaltyReturnTypeOnItsOwnLine: 2000000
|
||||
PointerAlignment: Right
|
||||
ReferenceAlignment: Right
|
||||
ReflowComments: true
|
||||
SortIncludes: true
|
||||
SortUsingDeclarations: true
|
||||
SpaceAfterCStyleCast: true
|
||||
SpaceAfterTemplateKeyword: true
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
SpaceBeforeCpp11BracedList: true
|
||||
SpaceBeforeCtorInitializerColon: true
|
||||
SpaceBeforeInheritanceColon: true
|
||||
SpaceBeforeParens: ControlStatements
|
||||
SpaceBeforeRangeBasedForLoopColon: true
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesBeforeTrailingComments: 1
|
||||
SpacesInAngles: false
|
||||
SpacesInContainerLiterals: false
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInParentheses: false
|
||||
SpacesInSquareBrackets: false
|
||||
SpaceBeforeSquareBrackets: false
|
||||
SpaceBeforeCaseColon: false
|
||||
SpaceInEmptyBlock: false
|
||||
SpacesInConditionalStatement: false
|
||||
Standard: Cpp11
|
||||
StatementMacros:
|
||||
- Q_UNUSED
|
||||
- QT_REQUIRE_VERSION
|
||||
# using a big tab-width so abuse is shown immediately
|
||||
TabWidth: 8
|
||||
UseTab: Never
|
||||
DeriveLineEnding: false
|
||||
UseCRLF: false
|
||||
...
|
|
@ -0,0 +1,121 @@
|
|||
---
|
||||
Checks: '
|
||||
-*,
|
||||
clang-*,
|
||||
bugprone-assert-side-effect,
|
||||
bugprone-bool-pointer-implicit-conversion,
|
||||
bugprone-incorrect-roundings,
|
||||
bugprone-integer-division,
|
||||
bugprone-macro-parentheses,
|
||||
bugprone-macro-repeated-side-effects,
|
||||
bugprone-misplaced-widening-cast,
|
||||
bugprone-multiple-statement-macro,
|
||||
bugprone-sizeof-expression,
|
||||
bugprone-suspicious-enum-usage,
|
||||
bugprone-suspicious-missing-comma,
|
||||
bugprone-suspicious-semicolon,
|
||||
bugprone-terminating-continue,
|
||||
bugprone-too-small-loop-variable,
|
||||
cppcoreguidelines-avoid-goto,
|
||||
misc-definitions-in-headers,
|
||||
misc-misplaced-const,
|
||||
misc-redundant-expression,
|
||||
misc-unused-parameters,
|
||||
readability-braces-around-statements,
|
||||
readability-const-return-type,
|
||||
readability-else-after-return,
|
||||
readability-function-size,
|
||||
readability-implicit-bool-conversion,
|
||||
readability-inconsistent-declaration-parameter-name,
|
||||
readability-isolate-declaration,
|
||||
readability-magic-numbers,
|
||||
readability-misplaced-array-index,
|
||||
readability-named-parameter,
|
||||
readability-non-const-parameter,
|
||||
readability-redundant-control-flow,
|
||||
readability-redundant-declaration,
|
||||
readability-redundant-preprocessor,
|
||||
readability-uppercase-literal-suffix,
|
||||
readability-identifier-naming,
|
||||
'
|
||||
WarningsAsErrors: '
|
||||
bugprone-assert-side-effect,
|
||||
bugprone-bool-pointer-implicit-conversion,
|
||||
bugprone-incorrect-roundings,
|
||||
bugprone-integer-division,
|
||||
bugprone-macro-parentheses,
|
||||
bugprone-macro-repeated-side-effects,
|
||||
bugprone-misplaced-widening-cast,
|
||||
bugprone-multiple-statement-macro,
|
||||
bugprone-sizeof-expression,
|
||||
bugprone-suspicious-enum-usage,
|
||||
bugprone-suspicious-missing-comma,
|
||||
bugprone-suspicious-semicolon,
|
||||
bugprone-terminating-continue,
|
||||
bugprone-too-small-loop-variable,
|
||||
cppcoreguidelines-avoid-goto,
|
||||
misc-definitions-in-headers,
|
||||
misc-misplaced-const,
|
||||
misc-redundant-expression,
|
||||
misc-unused-parameters,
|
||||
readability-braces-around-statements,
|
||||
readability-const-return-type,
|
||||
readability-else-after-return,
|
||||
readability-function-size,
|
||||
readability-implicit-bool-conversion,
|
||||
readability-inconsistent-declaration-parameter-name,
|
||||
readability-isolate-declaration,
|
||||
readability-magic-numbers,
|
||||
readability-misplaced-array-index,
|
||||
readability-named-parameter,
|
||||
readability-non-const-parameter,
|
||||
readability-redundant-control-flow,
|
||||
readability-redundant-declaration,
|
||||
readability-redundant-preprocessor,
|
||||
readability-uppercase-literal-suffix,
|
||||
# readability-identifier-naming,
|
||||
'
|
||||
|
||||
# From the docs: "Output warnings from headers matching this filter"
|
||||
# But the goal should be to exclude(!) the headers for which clang-tidy is not called,
|
||||
# e.g., for naming convention checks. DO NOT USE this field if you don't want to analyze
|
||||
# header files just because they're included (seems to work).
|
||||
# HeaderFilterRegex: '$'
|
||||
# https://github.com/Kitware/CMake/blob/master/.clang-tidy
|
||||
HeaderFilterRegex: '.*\.(h|hxx|cxx)$'
|
||||
AnalyzeTemporaryDtors: false
|
||||
FormatStyle: none
|
||||
User: martin
|
||||
CheckOptions:
|
||||
- { key: bugprone-assert-side-effect.AssertMacros, value: assert }
|
||||
- { key: bugprone-assert-side-effect.CheckFunctionCalls, value: '0' }
|
||||
- { key: bugprone-misplaced-widening-cast.CheckImplicitCasts, value: '1' }
|
||||
- { key: bugprone-sizeof-expression.WarnOnSizeOfConstant, value: '1' }
|
||||
- { key: bugprone-sizeof-expression.WarnOnSizeOfIntegerExpression, value: '1' }
|
||||
- { key: bugprone-sizeof-expression.WarnOnSizeOfThis, value: '1' }
|
||||
- { key: bugprone-sizeof-expression.WarnOnSizeOfCompareToConstant, value: '1' }
|
||||
- { key: bugprone-suspicious-enum-usage.StrictMode, value: '0' }
|
||||
- { key: bugprone-suspicious-missing-comma.MaxConcatenatedTokens, value: '5' }
|
||||
- { key: bugprone-suspicious-missing-comma.RatioThreshold, value: '0.200000' }
|
||||
- { key: bugprone-suspicious-missing-comma.SizeThreshold, value: '5' }
|
||||
- { key: misc-definitions-in-headers.HeaderFileExtensions, value: ',h,hh,hpp,hxx' }
|
||||
- { key: misc-definitions-in-headers.UseHeaderFileExtension, value: '1' }
|
||||
- { key: readability-braces-around-statements.ShortStatementLines, value: '1' }
|
||||
- { key: readability-function-size.LineThreshold, value: '500' }
|
||||
- { key: readability-function-size.StatementThreshold, value: '800' }
|
||||
- { key: readability-function-size.ParameterThreshold, value: '10' }
|
||||
- { key: readability-function-size.NestingThreshold, value: '6' }
|
||||
- { key: readability-function-size.VariableThreshold, value: '15' }
|
||||
- { key: readability-implicit-bool-conversion.AllowIntegerConditions, value: '0' }
|
||||
- { key: readability-implicit-bool-conversion.AllowPointerConditions, value: '0' }
|
||||
- { key: readability-implicit-bool-conversion.AllowPointerConditions, value: '0' }
|
||||
- { key: readability-inconsistent-declaration-parameter-name.IgnoreMacros, value: '1' }
|
||||
- { key: readability-inconsistent-declaration-parameter-name.Strict, value: '1' }
|
||||
- { key: readability-magic-numbers.IgnoredFloatingPointValues, value: '1.0;100.0;' }
|
||||
- { key: readability-magic-numbers.IgnoredIntegerValues, value: '1;2;3;4;' }
|
||||
- { key: readability-magic-numbers.IgnorePowersOf2IntegerValues, value: '0' }
|
||||
- { key: readability-magic-numbers.IgnoreAllFloatingPointValues, value: '0' }
|
||||
- { key: readability-redundant-declaration.IgnoreMacros, value: '1' }
|
||||
- { key: readability-redundant-function-ptr-dereference, value: '1' }
|
||||
- { key: readability-uppercase-literal-suffix.IgnoreMacros, value: '0' }
|
||||
- { key: readability-uppercase-literal-suffix.IgnoreMacros, value: '0' }
|
|
@ -19,3 +19,5 @@ RUN apt-get install -y --no-install-recommends \
|
|||
wget \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
VOLUME ["/builder/mnt"]
|
||||
WORKDIR /builder/mnt
|
Loading…
Reference in New Issue