-
Notifications
You must be signed in to change notification settings - Fork 0
/
.clang-tidy
129 lines (129 loc) · 5.53 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
---
# In some situations (line UnorderedPool constructor) it's impossible to make parameters unswappable. There are several
# cases like that, therefore bugprone-easily-swappable-parameters is disabled.
#
# We use assignment in if's in some cases to make code shorter and more readable.
# Therefore, bugprone-assignment-in-if-condition check is disabled.
#
# In a lot of cases we initialize or assert optionals in some way, but bugprone-unchecked-optional-access is triggered
# as there is no actual if-check near the usage. Therefore, we disable this check.
#
# Currently, `noexcept` means if function will throw something, program should just crash.
# Therefore, we disable bugprone-exception-escape for now. Might be reconsidered later.
# bugprone-unhandled-exception-at-new is disabled for the same reason.
#
# Some third party libraries like OGRE prefer to forward declare most of their classes and therefore trigger
# bugprone-forward-declaration-namespace warning. It's better to ignore this warning than to add unnecessary includes.
#
# We disable -readability-function-cognitive-complexity and -readability-magic-numbers,
# because they trigger shitstorm in tests. Might be reconsidered later.
#
# -readability-identifier-length is disabled, because it triggers on lots of meaningful math-related names
# like UP, _x, _t and so on.
#
# XXHash uses some intrinsics, that are not guaranteed to be portable. There is no way to ignore
# portability-simd-intrinsics only in ByteHasher.cpp, therefore it is ignored everywhere.
#
# We disable misc-const-correctness because it triggers on lots of local variables (more than 700 cases at the time
# of writing this comment) and it's not really useful enough to fix all of this (at least now).
#
# Unfortunately, we need to, I hope temporary, disable modernize-use-nullptr
# as it crashes clang-tidy from Visual Studio locally.
#
# We disable misc-use-anonymous-namespace as there is nothing wrong with using stack.
Checks: >
-*,
bugprone-*,
-bugprone-assignment-in-if-condition,
-bugprone-easily-swappable-parameters,
-bugprone-exception-escape,
-bugprone-forward-declaration-namespace,
-bugprone-unchecked-optional-access,
-bugprone-unhandled-exception-at-new,
cppcoreguidelines-avoid-goto,
cppcoreguidelines-interfaces-global-init,
cppcoreguidelines-narrowing-conversions,
cppcoreguidelines-pro-type-cstyle-cast,
cppcoreguidelines-pro-type-static-cast-downcast,
cppcoreguidelines-slicing,
cppcoreguidelines-special-member-functions,
llvm-namespace-comment,
misc-*,
-misc-const-correctness,
-misc-no-recursion,
-misc-non-private-member-variables-in-classes,
-misc-use-anonymous-namespace,
modernize-*,
-modernize-avoid-c-arrays,
-modernize-replace-disallow-copy-and-assign-macro,
-modernize-use-nullptr,
-modernize-use-trailing-return-type,
performance-*,
portability-*,
-portability-simd-intrinsics,
readability-*,
-readability-function-cognitive-complexity,
-readability-identifier-length,
-readability-implicit-bool-conversion,
-readability-magic-numbers,
-readability-uppercase-literal-suffix,
-readability-use-anyofallof
FormatStyle: file
HeaderFilterRegex: "Executable|Test|Unit"
WarningsAsErrors: '*'
CheckOptions:
# We are silencing CRT Secure warnings.
- key: bugprone-reserved-identifier.AllowedIdentifiers
value: '_CRT_SECURE_NO_WARNINGS'
# It's more reasonable to count macros as functions, but there is no option for it.
- key: readability-function-cognitive-complexity.IgnoreMacros
value: 'true'
- key: readability-identifier-naming.ClassCase
value: 'CamelCase'
- key: readability-identifier-naming.ClassMemberCase
value: 'camelBack'
- key: readability-identifier-naming.ClassMethodCase
value: 'CamelCase'
- key: readability-identifier-naming.ConstantCase
value: 'UPPER_CASE'
- key: readability-identifier-naming.ConstantMemberCase
value: 'camelBack'
- key: readability-identifier-naming.ConstantParameterCase
value: 'camelBack'
- key: readability-identifier-naming.ConstantParameterPrefix
value: '_'
- key: readability-identifier-naming.ConstexprVariableCase
value: 'UPPER_CASE'
- key: readability-identifier-naming.EnumCase
value: 'CamelCase'
- key: readability-identifier-naming.EnumConstantCase
value: 'UPPER_CASE'
- key: readability-identifier-naming.FunctionCase
value: 'CamelCase'
# `begin` and `end` functions are allowed, because they are used in foreach.
# Custom casts are allowed to use `*_cast` names to blend in with standard casts.
- key: readability-identifier-naming.FunctionIgnoredRegexp
value: '(begin|end|([a-z]+_cast))'
- key: readability-identifier-naming.LocalConstantCase
value: 'camelBack'
- key: readability-identifier-naming.MacroDefinitionCase
value: 'UPPER_CASE'
# We need to define _CRT* macros to silence MSVC warnings about C standard functions safety.
- key: readability-identifier-naming.MacroDefinitionIgnoredRegexp
value: '_CRT.*'
- key: readability-identifier-naming.NamespaceCase
value: 'CamelCase'
- key: readability-identifier-naming.ParameterCase
value: 'camelBack'
- key: readability-identifier-naming.ParameterPrefix
value: '_'
- key: readability-identifier-naming.ScopedEnumConstantCase
value: 'UPPER_CASE'
- key: readability-identifier-naming.TypeTemplateParameterCase
value: 'CamelCase'
# TODO: Adhok to silence CLang Tidy internal bug when C++ 20 is used.
- key: readability-identifier-naming.TypeTemplateParameterIgnoredRegexp
value: 'expr-type'
- key: readability-identifier-naming.VariableCase
value: 'camelBack'
...