Files
2026-10-21 15:10:30 +08:00

114 lines
5.0 KiB
YAML

# Here is an explanation for why some of the checks are disabled:
#
# -bugprone-casting-through-void
# <mpi.h> defines macro that generates casting through void.
#
# -bugprone-easily-swappable-parameters
# Required big refactoring in the codebase. It was not worth it.
#
# -bugprone-implicit-widening-of-multiplication-result
# This makes the code too verbose. It's unlikely we're going to overflow.
#
# -clang-analyzer-optin.taint.TaintedAlloc
# Tainted allocations are used on the nodes where we currently don't have a
# good limit on the number of nodes.
#
# -performance-enum-size
# Keeping the code simple is more important than performance in this case.
#
# -performance-inefficient-string-concatenation
# It's common that we concatenate strings with +. For cases other than
# loops, using `append` is not worth it and makes the code less readable.
#
# -modernize-loop-convert
# As range-based for loops are only available since OpenMP 5,
# this check should not be used on code with a compatibility requirement of OpenMP prior to version 5.
#
# -modernize-use-auto:
# The use of auto is not always beneficial.
# It can make the code less readable and harder to understand.
#
# -modernize-use-nodiscard:
# The leading [[nodiscard]] attribute adds noise to the code when reading it
# and may not provide considerable benefits.
#
# -modernize-use-trailing-return-type:
# Most of the times, trailing return types provide no benefit.
# The additional "auto" and "->" are just noise.
#
# NOTE:
# This codebase heavily interacts with standard C libraries, so most of the `cppcoreguidelines`
# checks are disabled. In particular,
# cppcoreguidelines-init-variables: Many C library functions use output parameters.
# We intentionally avoid initializing variables passed to them,
# so that we get warnings if those variables are used before being properly set.
# cppcoreguidelines-pro-type-vararg: Variadic functions are used, as pre-C++20 lacks sufficient
# formatting support.
Checks: >
-*,
bugprone-*,
-bugprone-casting-through-void,
-bugprone-easily-swappable-parameters,
-bugprone-implicit-widening-of-multiplication-result,
performance-*,
-performance-enum-size,
-performance-inefficient-string-concatenation,
cppcoreguidelines-macro-usage,
cppcoreguidelines-no-malloc,
cppcoreguidelines-pro-type-cstyle-cast,
clang-analyzer-*,
modernize-*,
-modernize-loop-convert,
-modernize-use-auto,
-modernize-use-nodiscard,
-modernize-use-trailing-return-type,
readability-avoid-const-params-in-decls,
readability-avoid-nested-conditional-operator,
readability-avoid-return-with-void-value,
readability-avoid-unconditional-preprocessor-if,
readability-container-size-empty,
readability-delete-null-pointer,
readability-duplicate-include,
readability-else-after-return,
readability-identifier-naming,
readability-inconsistent-declaration-parameter-name,
readability-magic-numbers
readability-make-member-function-const,
readability-math-missing-parentheses,
readability-misleading-indentation,
readability-non-const-parameter,
readability-redundant-casting,
readability-redundant-control-flow,
readability-redundant-declaration,
readability-redundant-function-ptr-dereference,
readability-redundant-inline-specifier,
readability-redundant-preprocessor,
readability-reference-to-constructed-temporary,
readability-simplify-boolean-expr,
readability-simplify-subscript-expr,
readability-static-accessed-through-instance,
readability-static-definition-in-anonymous-namespace,
readability-string-compare,
# For details on the checks, see:
# https://clang.llvm.org/extra/clang-tidy/checks/list.html
CheckOptions:
- { key: readability-identifier-naming.ClassCase, value: CamelCase }
- { key: readability-identifier-naming.StructCase, value: CamelCase }
- { key: readability-identifier-naming.UnionCase, value: CamelCase }
- { key: readability-identifier-naming.EnumCase, value: CamelCase }
- { key: readability-identifier-naming.TypeAliasCase, value: CamelCase }
- { key: readability-identifier-naming.TypedefCase, value: CamelCase }
- { key: readability-identifier-naming.TemplateParameterCase, value: CamelCase }
- { key: readability-identifier-naming.FunctionCase, value: lower_case }
- { key: readability-identifier-naming.MethodCase, value: lower_case }
- { key: readability-identifier-naming.VariableCase, value: lower_case }
- { key: readability-identifier-naming.ParameterCase, value: lower_case }
- { key: readability-identifier-naming.ConstantCase, value: UPPER_CASE }
- { key: readability-identifier-naming.ConstantParameterCase, value: lower_case }
- { key: readability-identifier-naming.LocalConstantCase, value: lower_case }
- { key: readability-identifier-naming.MacroDefinitionCase, value: UPPER_CASE }
- { key: readability-identifier-naming.NamespaceCase, value: lower_case }