Skip to content

Instantly share code, notes, and snippets.

@madskjeldgaard
Created December 22, 2022 19:08
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 madskjeldgaard/eaee8f193569b8da0ca121713a8e216c to your computer and use it in GitHub Desktop.
Save madskjeldgaard/eaee8f193569b8da0ca121713a8e216c to your computer and use it in GitHub Desktop.
A clang-tidy config file. Place at the root of your project
---
# Enable ALL the things! Except not really
# misc-non-private-member-variables-in-classes: the options don't do anything
# modernize-use-nodiscard: too aggressive, attribute is situationally useful
Checks: "*,\
-google-readability-todo,\
-altera-*,\
-fuchsia-*,\
fuchsia-multiple-inheritance,\
-llvm-header-guard,\
-llvm-include-order,\
-llvmlibc-*,\
-modernize-use-nodiscard,\
-misc-non-private-member-variables-in-classes"
WarningsAsErrors: ''
CheckOptions:
- key: 'bugprone-argument-comment.StrictMode'
value: 'true'
# Prefer using enum classes with 2 values for parameters instead of bools
- key: 'bugprone-argument-comment.CommentBoolLiterals'
value: 'true'
- key: 'bugprone-misplaced-widening-cast.CheckImplicitCasts'
value: 'true'
- key: 'bugprone-sizeof-expression.WarnOnSizeOfIntegerExpression'
value: 'true'
- key: 'bugprone-suspicious-string-compare.WarnOnLogicalNotComparison'
value: 'true'
- key: 'readability-simplify-boolean-expr.ChainedConditionalReturn'
value: 'true'
- key: 'readability-simplify-boolean-expr.ChainedConditionalAssignment'
value: 'true'
- key: 'readability-uniqueptr-delete-release.PreferResetCall'
value: 'true'
- key: 'cppcoreguidelines-init-variables.MathHeader'
value: '<cmath>'
- key: 'cppcoreguidelines-narrowing-conversions.PedanticMode'
value: 'true'
- key: 'readability-else-after-return.WarnOnUnfixable'
value: 'true'
- key: 'readability-else-after-return.WarnOnConditionVariables'
value: 'true'
- key: 'readability-inconsistent-declaration-parameter-name.Strict'
value: 'true'
- key: 'readability-qualified-auto.AddConstToQualified'
value: 'true'
- key: 'readability-redundant-access-specifiers.CheckFirstDeclaration'
value: 'true'
# These seem to be the most common identifier styles
- key: 'readability-identifier-naming.AbstractClassCase'
value: 'CamelCase'
- key: 'readability-identifier-naming.ClassCase'
value: 'CamelCase'
- key: 'readability-identifier-naming.ClassConstantCase'
value: 'camelCase'
- key: 'readability-identifier-naming.ClassMemberCase'
value: 'camelCase'
- key: 'readability-identifier-naming.ClassMethodCase'
value: 'camelCase'
- key: 'readability-identifier-naming.ConstantCase'
value: 'camelCase'
- key: 'readability-identifier-naming.ConstantMemberCase'
value: 'camelCase'
- key: 'readability-identifier-naming.ConstantParameterCase'
value: 'camelCase'
- key: 'readability-identifier-naming.ConstantPointerParameterCase'
value: 'camelCase'
- key: 'readability-identifier-naming.ConstexprFunctionCase'
value: 'camelCase'
- key: 'readability-identifier-naming.ConstexprMethodCase'
value: 'camelCase'
- key: 'readability-identifier-naming.ConstexprVariableCase'
value: 'camelCase'
- key: 'readability-identifier-naming.EnumCase'
value: 'CamelCase'
- key: 'readability-identifier-naming.EnumConstantCase'
value: 'CamelCase'
- key: 'readability-identifier-naming.FunctionCase'
value: 'camelCase'
- key: 'readability-identifier-naming.GlobalConstantCase'
value: 'camelCase'
- key: 'readability-identifier-naming.GlobalConstantPointerCase'
value: 'camelCase'
- key: 'readability-identifier-naming.GlobalFunctionCase'
value: 'camelCase'
- key: 'readability-identifier-naming.GlobalPointerCase'
value: 'camelCase'
- key: 'readability-identifier-naming.GlobalVariableCase'
value: 'camelCase'
- key: 'readability-identifier-naming.InlineNamespaceCase'
value: 'camelCase'
- key: 'readability-identifier-naming.LocalConstantCase'
value: 'camelCase'
- key: 'readability-identifier-naming.LocalConstantPointerCase'
value: 'camelCase'
- key: 'readability-identifier-naming.LocalPointerCase'
value: 'camelCase'
- key: 'readability-identifier-naming.LocalVariableCase'
value: 'camelCase'
- key: 'readability-identifier-naming.MacroDefinitionCase'
value: 'UPPER_CASE'
- key: 'readability-identifier-naming.MemberCase'
value: 'camelCase'
- key: 'readability-identifier-naming.MethodCase'
value: 'camelCase'
- key: 'readability-identifier-naming.NamespaceCase'
value: 'camelCase'
- key: 'readability-identifier-naming.ParameterCase'
value: 'camelCase'
- key: 'readability-identifier-naming.ParameterPackCase'
value: 'camelCase'
- key: 'readability-identifier-naming.PointerParameterCase'
value: 'camelCase'
- key: 'readability-identifier-naming.PrivateMemberCase'
value: 'camelCase'
- key: 'readability-identifier-naming.PrivateMemberPrefix'
value: 'm_'
- key: 'readability-identifier-naming.PrivateMethodCase'
value: 'camelCase'
- key: 'readability-identifier-naming.ProtectedMemberCase'
value: 'camelCase'
- key: 'readability-identifier-naming.ProtectedMemberPrefix'
value: 'm_'
- key: 'readability-identifier-naming.ProtectedMethodCase'
value: 'camelCase'
- key: 'readability-identifier-naming.PublicMemberCase'
value: 'camelCase'
- key: 'readability-identifier-naming.PublicMethodCase'
value: 'camelCase'
- key: 'readability-identifier-naming.ScopedEnumConstantCase'
value: 'CamelCase'
- key: 'readability-identifier-naming.StaticConstantCase'
value: 'camelCase'
- key: 'readability-identifier-naming.StaticVariableCase'
value: 'camelCase'
- key: 'readability-identifier-naming.StructCase'
value: 'CamelCase'
- key: 'readability-identifier-naming.TemplateParameterCase'
value: 'CamelCase'
- key: 'readability-identifier-naming.TemplateTemplateParameterCase'
value: 'CamelCase'
- key: 'readability-identifier-naming.TypeAliasCase'
value: 'CamelCase'
- key: 'readability-identifier-naming.TypedefCase'
value: 'CamelCase'
- key: 'readability-identifier-naming.TypeTemplateParameterCase'
value: 'CamelCase'
- key: 'readability-identifier-naming.UnionCase'
value: 'CamelCase'
- key: 'readability-identifier-naming.ValueTemplateParameterCase'
value: 'CamelCase'
- key: 'readability-identifier-naming.VariableCase'
value: 'camelCase'
- key: 'readability-identifier-naming.VirtualMethodCase'
value: 'camelCase'
- key: modernize-loop-convert.MaxCopySize
value: '16'
- key: modernize-loop-convert.MinConfidence
value: reasonable
- key: modernize-loop-convert.NamingStyle
value: CamelCase
- key: modernize-pass-by-value.IncludeStyle
value: llvm
- key: modernize-replace-auto-ptr.IncludeStyle
value: llvm
- key: modernize-use-nullptr.NullMacros
value: 'NULL'
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment