vessel/web/.clang-tidy
Arija A. bf87b89080
refact: Update macro formats.
Signed-off-by: Arija A. <ari@ari.lt>
2025-06-14 16:20:50 +03:00

171 lines
6.8 KiB
YAML

Checks: >
clang-analyzer-*
,bugprone-*
,performance-*
,portability-*
,readability-*
,misc-*
,modernize-avoid-c-arrays
,modernize-deprecated-headers
,modernize-use-nullptr
,modernize-use-default-member-init
,modernize-use-using
,modernize-loop-conversion
,modernize-make-unique
,modernize-return-braced-init-list
,modernize-use-auto
,modernize-avoid-bind
,modernize-redundant-void-arg
,modernize-use-trailing-return-type
,cppcoreguidelines-*
,cert-*
,hicpp-*
,clang-diagnostic-*
,clang-diagnostic-unused-parameter
,clang-diagnostic-unused-variable
,clang-diagnostic-sign-compare
,clang-diagnostic-deprecated-declarations
,clang-diagnostic-conversion
,clang-diagnostic-unused-function
,clang-diagnostic-unused-const-variable
,clang-diagnostic-unreachable-code
,clang-diagnostic-implicit-fallthrough
,clang-diagnostic-missing-noreturn
,clang-diagnostic-misleading-indentation
,clang-diagnostic-parentheses
,clang-diagnostic-pp-conditional
,clang-diagnostic-self-assign
,clang-diagnostic-uninitialized
,-misc-include-cleaner
,-cppcoreguidelines-avoid-non-const-global-variables
,-cppcoreguidelines-pro-bounds-array-to-pointer-decay
,-cppcoreguidelines-owning-memory
,-cppcoreguidelines-avoid-magic-numbers
,-cppcoreguidelines-macro-to-enum
,-readability-magic-numbers
WarningsAsErrors: "*"
HeaderFilterRegex: ".*"
FormatStyle: file
CheckOptions:
# Naming rules for public API
- { key: readability-identifier-naming.GlobalVariableCase, value: aNy_CasE }
- { key: readability-identifier-naming.GlobalVariablePrefix, value: "vw_" }
- { key: readability-identifier-naming.GlobalConstantCase, value: aNy_CasE }
- { key: readability-identifier-naming.GlobalConstantPrefix, value: "vw_" }
- { key: readability-identifier-naming.FunctionCase, value: aNy_CasE }
- { key: readability-identifier-naming.FunctionPrefix, value: "vw_" }
- { key: readability-identifier-naming.GlobalFunctionCase, value: aNy_CasE }
- { key: readability-identifier-naming.GlobalFunctionPrefix, value: "vw_" }
- { key: readability-identifier-naming.ClassCase, value: CamelCase }
- { key: readability-identifier-naming.ClassPrefix, value: "vw_" }
- { key: readability-identifier-naming.EnumCase, value: CamelCase }
- { key: readability-identifier-naming.EnumPrefix, value: "vw_" }
- { key: readability-identifier-naming.UnionCase, value: CamelCase }
- { key: readability-identifier-naming.UnionPrefix, value: "vw_" }
- { key: readability-identifier-naming.TypedefCase, value: CamelCase }
- { key: readability-identifier-naming.TypedefPrefix, value: "vw_" }
- { key: readability-identifier-naming.TypeAliasCase, value: CamelCase }
- { key: readability-identifier-naming.TypeAliasPrefix, value: "vw_" }
- {
key: readability-identifier-naming.MacroDefinitionCase,
value: UPPER_CASE,
}
- {
key: readability-identifier-naming.MacroDefinitionIgnoredRegexp,
value: "^VESSEL_WEB_[A-Z_]+_H_$|^vw__.*$",
}
- { key: readability-identifier-naming.MacroDefinitionPrefix, value: "VW_" }
- { key: readability-identifier-naming.VariableCase, value: lower_case }
- { key: readability-identifier-naming.NamespaceCase, value: lower_case }
# General code practices
- { key: readability-magic-numbers.IgnoredIntegerValues, value: "-1;0;1;2;10" }
- { key: readability-magic-numbers.IgnoredFloatingPointValues, value: "1.0;100.0;10.0;0.0" }
- { key: readability-const-return-type, value: "true" }
- { key: readability-const-parameter, value: "true" }
- { key: cppcoreguidelines-avoid-magic-numbers.IgnoreEnums, value: "1" }
- {
key: cppcoreguidelines-avoid-magic-numbers.IgnoreMacroDefines,
value: "1",
}
# Function length and complexity
- { key: readability-function-size.LineThreshold, value: "64" }
- { key: readability-function-cognitive-complexity.Threshold, value: "32" }
- {
key: readability-function-cognitive-complexity.Severity,
value: "Error",
}
# Use of const, explicit casts, and return types
- { key: modernize-use-nullptr.NullMacros, value: "NULL" }
- { key: cppcoreguidelines-pro-type-const-cast.StrictMode, value: "true" }
- {
key: cppcoreguidelines-pro-type-reinterpret-cast.StrictMode,
value: "true",
}
# Portability and system includes
- { key: portability-restrict-system-includes, value: "true" }
- { key: portability-simd-intrinsics, value: "false" }
- { key: portability-const-string-compare, value: "true" }
# Performance checks (more sensitive)
- { key: performance-unnecessary-value-param.AllowedTypes, value: "" }
- { key: performance-inefficient-vector-operation, value: "true" }
- { key: performance-pod-global-static, value: "true" }
# Memory and safety
- { key: cppcoreguidelines-no-automatic-move, value: "true" }
- { key: cppcoreguidelines-no-automatic-copies, value: "true" }
# Avoid magic numbers
- { key: readability-magic-numbers.IgnoredEnums, value: "1" }
- { key: readability-magic-numbers.IgnoredMacroDefines, value: "1" }
- { key: readability-magic-numbers.MinOccurances, value: "3" }
# Documentation and comments
- { key: misc-doxygen-comment-on-function, value: "true" }
- { key: readability-doxygen-function-comment, value: "true" }
- { key: readability-doxygen-param-comment, value: "true" }
- { key: readability-doxygen-return-comment, value: "true" }
# Type safety
- { key: cppcoreguidelines-pro-type-union-access, value: "true" }
- { key: cppcoreguidelines-pro-type-static-cast-downcast, value: "true" }
# Function signature guidelines
- { key: modernize-deprecated-headers.Warn, value: "true" }
# Logic and usage
- { key: clang-diagnostic-unused-function, value: "true" }
- { key: clang-diagnostic-unused-variable, value: "true" }
- { key: clang-diagnostic-implicit-fallthrough, value: "true" }
- { key: clang-diagnostic-missing-noreturn, value: "true" }
- { key: clang-diagnostic-unreachable-code, value: "true" }
- { key: clang-diagnostic-self-assign, value: "true" }
# Null Checks
- { key: clang-analyzer-null-dereference, value: "true" }
- { key: clang-analyzer-null-return, value: "true" }
- { key: clang-analyzer-core.NullDereference, value: "true" }
# Stylistic checks
- { key: readability-named-parameter-naming-style, value: "snake_case" }
- { key: readability-function-parameter-naming-style, value: "snake_case" }
- { key: readability-identifier-naming-style, value: "snake_case" }
# More aggressive alignment
- { key: modernize-align-pointers, value: "true" }
# Allow conf.h
- { key: misc-include-cleaner.IgnoreHeaders, value: '.*conf\.h' }