forked from OpenAtomFoundation/pika
-
Notifications
You must be signed in to change notification settings - Fork 2
/
.clang-tidy
140 lines (135 loc) · 7.71 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
---
Checks: '
bugprone-*,
clang-analyzer-*,
google-*,
modernize-*,
performance-*,
portability-*,
-readability-*,
-cppcoreguidelines-*,
-bugprone-easily-swappable-parameters,
-bugprone-implicit-widening-of-multiplication-result,
-bugprone-reserved-identifier,
-bugprone-signed-char-misuse,
-bugprone-branch-clone,
-clang-analyzer-cplusplus.NewDelete,
-clang-analyzer-cplusplus.NewDeleteLeaks,
-clang-analyzer-security.insecureAPI.rand,
-clang-analyzer-cplusplus.InnerPointer,
-clang-analyzer-core.CallAndMessage,
-clang-analyzer-deadcode.DeadStores,
-clang-diagnostic-implicit-int-float-conversion,
-clang-diagnostic-unused-command-line-argument,
-clang-diagnostic-ignored-optimization-argument,
-google-readability-avoid-underscore-in-googletest-name,
-google-default-arguments,
-google-explicit-constructor,
-google-runtime-int,
-modernize-avoid-c-arrays,
-modernize-use-nodiscard,
-modernize-use-trailing-return-type,
-modernize-pass-by-value,
-modernize-concat-nested-namespaces,
-modernize-return-braced-init-list,
-modernize-use-equals-delete,
-modernize-redundant-void-arg,
-readability-convert-member-functions-to-static,
-readability-identifier-length,
-readability-function-cognitive-complexity,
-readability-magic-numbers,
-readability-make-member-function-const,
-readability-qualified-auto,
-readability-redundant-access-specifiers,
-readability-function-size,
-readability-else-after-return,
-readability-use-anyofallof,
-readability-implicit-bool-conversion,
-use_of_tag_name_without_tag,
'
# naming check
CheckOptions:
- { key: readability-identifier-naming.ClassCase, value: CamelCase }
- { key: readability-identifier-naming.EnumCase, value: CamelCase }
- { key: readability-identifier-naming.FunctionCase, value: CamelCase }
- { key: readability-identifier-naming.NamespaceCase, value: lower_case }
- { key: readability-identifier-naming.StructCase, value: CamelCase }
- { key: readability-identifier-naming.UnionCase, value: CamelCase }
- { key: readability-identifier-naming.TemplateParameterCase, value: CamelCase }
- { key: readability-identifier-naming.MacroDefinitionCase, value: UPPER_CASE }
- { key: readability-identifier-naming.GlobalConstantCase, value: CamelCase }
- { key: readability-identifier-naming.GlobalConstantPrefix, value: k }
- { key: readability-identifier-naming.MemberConstantCase, value: CamelCase }
- { key: readability-identifier-naming.MemberConstantPrefix, value: k }
- { key: readability-identifier-naming.EnumConstantCase, value: CamelCase }
- { key: readability-identifier-naming.EnumConstantPrefix, value: k }
# - { key: readability-identifier-naming.StaticConstantCase, value: CamelCase }
# - { key: readability-identifier-naming.StaticConstantPrefix, value: k }
# - { key: readability-identifier-naming.ConstantCase, value: CamelCase }
# - { key: readability-identifier-naming.ConstantPrefix, value: k }
# - { key: readability-identifier-naming.ConstantParameterCase, value: lower_case}
- { key: readability-identifier-naming.GlobalVariableCase, value: lower_case }
- { key: readability-identifier-naming.GlobalVariablePrefix, value: g_pika_ }
- { key: readability-identifier-naming.VariableCase, value: lower_case }
- { key: readability-identifier-naming.PublicMethodCase, value: CamelCase }
- { key: readability-identifier-naming.PrivateMethodCase, value: camelBack }
- { key: readability-identifier-naming.ProtectedMethodCase, value: camelBack }
- { key: readability-identifier-naming.MemberCase, value: lower_case }
- { key: readability-identifier-naming.MemberSuffix, value: _ }
WarningsAsErrors: '*'
HeaderFilterRegex: '((pstd|net|storage)/include/.+\.h|include/pika_.+\.h)'
AnalyzeTemporaryDtors: true
#### Disabled checks and why: #####
#
# -readability-convert-member-functions-to-static,
# This check started going off in the upgrade from clang-tidy-8 to clang-tidy-12. It is not always correct because
# we hide the reference implementation in another repository.
# -clang-analyzer-security.insecureAPI.rand, -clang-analyzer-security.insecureAPI.rand, -bugprone-unhandled-self-assignment,
# -bugprone-implicit-widening-of-multiplication-result
# These have not been investigated yet.
# -bugprone-reserved-identifier,
# Fails due to use of some __SHORT_FILE__ symbol, originating from very old code.
# -bugprone-suspicious-include,
# False positive due to GTest code.
# -bugprone-too-small-loop-variable,
# Complains about uint8_t or uint16_t when the limit on the loop is a container's .size() (size_t).
# We usually do this when we know the maximum size of the container though, so propose leaving disabled.
# -clang-analyzer-cplusplus.NewDelete,
# Seems to generate false positives. Suggest relying on ASAN and valgrind for memory stuff.
# -clang-analyzer-cplusplus.NewDeleteLeaks,
# Seems to generate false positives. Suggest relying on ASAN and valgrind for memory stuff.
# -modernize-use-nodiscard,
# New C++17 feature, slightly polarizing. Would clutter codebase.
# -modernize-avoid-c-arrays,
# Let's not deal with people doing ridiculous things to hack around this. If it bites them, it bites them.
# -bugprone-signed-char-misuse, -clang-diagnostic-implicit-int-float-conversion, -readability-make-member-function-const,
# -readability-qualified-auto, -readability-redundant-access-specifiers
# These were previously disabled for not being available in clang-tidy-8. They are now available on our clang-tidy-12,
# and potentially worth investigating/fixing.
# -bugprone-exception-escape
# Weird. No idea how to resolve.
# -bugprone-branch-clone,
# frequent misidentification
# -google-default-arguments
# Too many virtual functions in pika have default parameters, specifically void Do(std::shared_ptr<Partition> partition = nullptr)
# -clang-analyzer-cplusplus.InnerPointer
# I don't know why this bug in the RocksDB library fails to suppress detection.So I have to disable this check.
#--google-explicit-constructor
# There are so many implicit convert in pika
#--use_of_tag_name_without_tag
# like class member is class , If there is no class tag, an error will be reported
# class A{ B b_; } -> error ; class A{ class B b_; } -> no error ;
#-clang-analyzer-core.CallAndMessage
# pika/src/storage/src/scope_record_lock.h
# Always detect a null pointer and call the TryLock method
# Called C++ object pointer is null [clang-analyzer-core.CallAndMessage,-warnings-as-errors]
# lock_mgr_->UnLock(key);
#-clang-analyzer-deadcode.DeadStores
# error detection in some places
#-google-runtime-int
# todo discussed, because there are so many of `long` and `long long` in pika, so disable for now
#-clang-diagnostic-unused-command-line-argument
# because there are to many compile command error in github ci, but no error in local environment
# See in build folder compile_commands.json
#-clang-diagnostic-ignored-optimization-argument
# The reason disabled this is same as above.