forked from Checkmk/checkmk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.clang-tidy
65 lines (65 loc) · 5.88 KB
/
.clang-tidy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
---
# Classification of the excludes:
#
# * unclear, need to figure out if we want that:
# * cert-err58-cpp ("construction of 'foo' with static storage duration may throw an exception that cannot be caught")
# * cppcoreguidelines-pro-bounds-array-to-pointer-decay ("do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead")
# * cppcoreguidelines-pro-bounds-constant-array-index ("do not use array subscript when the index is not an integer constant expression; use gsl::at() instead")
# * cppcoreguidelines-pro-bounds-pointer-arithmetic ("do not use pointer arithmetic")
# * google-runtime-int ("consider replacing 'unsigned long' with 'uint64'")
# * hicpp-no-array-decay ("do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead")
#
# * undesirable checks:
# * cppcoreguidelines-pro-type-static-cast-downcast ("do not use static_cast to downcast from a base to a derived class; use dynamic_cast instead")
# * fuchsia-default-arguments ("calling a function that uses a default argument is disallowed")
# * fuchsia-overloaded-operator ("cannot overload 'operatorFOO'")
# * fuchsia-statically-constructed-objects ("static objects are disallowed; if possible, use a constexpr constructor instead")
# * google-runtime-references ("non-const reference parameter 'foo', make it const or use a pointer")
# * hicpp-no-assembler ("do not use inline assembler in safety-critical code") triggered by ntohs/htons
# * llvm-include-order ("#includes are not sorted properly")
#
# * desirable checks, but hard to fix currently:
# * android-cloexec-fopen ("use 'fopen' mode 'e' to set O_CLOEXEC") Ancient CentOS 5 doesn't have O_CLOEXEC
# * android-cloexec-open ("'open' should use O_CLOEXEC where possible") Ancient CentOS 5 doesn't have O_CLOEXEC
# * cert-env33-c ("calling 'system' uses a command processor")
# * cert-err34-c ("'atoi' used to convert a string to an integer value, but function will not report conversion errors; consider using 'strtol' instead")
# * cppcoreguidelines-owning-memory ("deleting a pointer through a type that is not marked 'gsl::owner<>'; consider using a smart pointer instead") We won't fix this for 1.5.0
# * cppcoreguidelines-pro-type-member-init ("uninitialized record type: 'foo'")
# * cppcoreguidelines-pro-type-reinterpret-cast ("do not use reinterpret_cast")
# * cppcoreguidelines-pro-type-vararg ("do not call c-style vararg functions")
# * hicpp-member-init: alias for cppcoreguidelines-pro-type-member-init
# * hicpp-signed-bitwise ("use of a signed integer operand with a binary bitwise operator")
# * hicpp-vararg ("do not call c-style vararg functions")
# * llvm-header-guard ("header guard does not follow preferred style") tricky to get right with the current bear/clang-tidy/symlink situation
#
# * desirable checks, but some places need to be suppressed:
# * cppcoreguidelines-pro-type-const-cast ("do not use const_cast")
# * cppcoreguidelines-pro-type-union-access ("do not access members of unions; use (boost::)variant instead")
# * modernize-use-bool-literals ("converting integer literal to bool, use bool literal instead") Incorrectly triggered by e.g. FD_ZERO
#
# * temporarily disabled:
# * clang-analyzer-optin.performance.Padding
# * cppcoreguidelines-avoid-c-arrays / hicpp-avoid-c-arrays / modernize-avoid-c-arrays
# * cppcoreguidelines-avoid-magic-numbers / readability-magic-numbers
# * cppcoreguidelines-special-member-functions / hicpp-special-member-functions
# * modernize-use-default-member-init
#
# * bug in toolchain/clang-tidy:
# * clang-analyzer-cplusplus.NewDeleteLeaks ("Potential leak of memory pointed to by field '_M_head_impl'") See https://bugs.llvm.org/show_bug.cgi?id=38176 ("clang-analyzer-cplusplus.NewDeleteLeaks false positive in C++17 mode only")
#
Checks: '*,-android-cloexec-fopen,-android-cloexec-open,-cert-env33-c,-cert-err34-c,-cert-err58-cpp,-clang-analyzer-alpha*,-cppcoreguidelines-owning-memory,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-cppcoreguidelines-pro-bounds-constant-array-index,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-pro-type-const-cast,-cppcoreguidelines-pro-type-member-init,-cppcoreguidelines-pro-type-reinterpret-cast,-cppcoreguidelines-pro-type-static-cast-downcast,-cppcoreguidelines-pro-type-union-access,-cppcoreguidelines-pro-type-vararg,-fuchsia-default-arguments,-fuchsia-overloaded-operator,-fuchsia-statically-constructed-objects,-google-runtime-int,-google-runtime-references,-hicpp-member-init,-hicpp-no-array-decay,-hicpp-no-assembler,-hicpp-signed-bitwise,-hicpp-vararg,-llvm-header-guard,-llvm-include-order,-modernize-use-bool-literals,-clang-analyzer-optin.performance.Padding,-cppcoreguidelines-avoid-c-arrays,-hicpp-avoid-c-arrays,-modernize-avoid-c-arrays,-cppcoreguidelines-avoid-magic-numbers,-readability-magic-numbers,-cppcoreguidelines-special-member-functions,-hicpp-special-member-functions,-modernize-use-default-member-init,-clang-analyzer-cplusplus.NewDeleteLeaks'
# Alas, readability-identifier-naming still has a few bugs. Nevertheless, we already configure a few things here...
CheckOptions:
- key: google-readability-namespace-comments.SpacesBeforeComments
value: '1'
- key: misc-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic
value: '1'
- key: readability-identifier-naming.MemberCase
value: 'lower_case'
- key: readability-identifier-naming.ProtectedMemberSuffix
value: '_'
- key: readability-identifier-naming.PrivateMemberSuffix
value: '_'
- key: readability-identifier-naming.VariableCase
value: 'lower_case'
...