-
Notifications
You must be signed in to change notification settings - Fork 0
/
.clang-tidy
148 lines (140 loc) · 5.27 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
141
142
143
144
145
146
147
148
---
# -bugprone-easily-swappable-parameters: Noisy, and there are other checks that
# catch things like suspicious call arguments.
#
# -bugprone-exception-escape: We don't use exceptions and will be building with
# -fno-exceptions soon.
#
# -bugprone-narrowing-conversions: Very noisy for not much gain.
#
# -cert-dcl21-cpp: Deprecated, will be removed in clang-tidy 19.
# https://releases.llvm.org/17.0.1/tools/clang/tools/extra/docs/clang-tidy/checks/cert/dcl21-cpp.html
#
# -cppcoreguidelines-[...]: TODO(robinlidnen): Investigate.
#
# -google-build-using-namespace: We use `using namespace` in tests and for std::literals.
#
# -misc-const-correctness: Consts some things that can't be const, and very very noisy.
#
# -misc-no-recursion: We use a lot of recursion.
#
# -modernize-make-unique, -modernize-use-emplace: Clang doesn't implement p0960
# yet, and we're not adding c-tors to all our structs.
#
# -modernize-use-nodiscard: Very noisy, and probably more meaningful if we only
# add it where it matters.
#
# -modernize-use-trailing-return-type: Stylistic change, and something we
# haven't been doing so far.
#
# -readability-container-data-pointer: We actually want a pointer to the first element.
#
# -readability-convert-member-functions-to-static: Makes some APIs confusing, especially when
# used in combination with readability-static-accessed-through-instance.
#
# -readability-function-cognitive-complexity: TODO(robinlinden): Investigate. Maybe case-by-case.
#
# -readability-function-size: TODO(robinlinden): Investigate. Maybe case-by-case.
#
# -readability-identifier-length: Requiring at least 3 characters for identifiers is silly.
#
# -readability-magic-numbers: Things implemented from specs and unit tests
# contain a lot of magic numbers.
#
# -readability-named-parameter: Leaving out argument names is fine where it doesn't add anything.
#
# -readability-redundant-member-init: TODO(robinlinden): Investigate.
#
# -readability-uppercase-literal-suffix: TODO(robinlinden): Investigate.
Checks: >
bugprone-*,
cert-*,
concurrency-*,
cppcoreguidelines-*,
google-*,
misc-*,
modernize-*,
performance-*,
readability-*,
readability-avoid-unconditional-preprocessor-if,
-bugprone-easily-swappable-parameters,
-bugprone-exception-escape,
-bugprone-narrowing-conversions,
-cert-dcl21-cpp,
-cppcoreguidelines-avoid-const-or-ref-data-members,
-cppcoreguidelines-avoid-do-while,
-cppcoreguidelines-avoid-magic-numbers,
-cppcoreguidelines-narrowing-conversions,
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
-cppcoreguidelines-pro-bounds-constant-array-index,
-cppcoreguidelines-pro-bounds-pointer-arithmetic,
-cppcoreguidelines-pro-type-reinterpret-cast,
-cppcoreguidelines-pro-type-static-cast-downcast,
-cppcoreguidelines-pro-type-union-access,
-cppcoreguidelines-rvalue-reference-param-not-moved,
-cppcoreguidelines-special-member-functions,
-google-build-using-namespace,
-google-readability-todo,
-misc-const-correctness,
-misc-no-recursion,
-modernize-make-unique,
-modernize-use-emplace,
-modernize-use-nodiscard,
-modernize-use-trailing-return-type,
-readability-container-data-pointer,
-readability-convert-member-functions-to-static,
-readability-function-cognitive-complexity,
-readability-function-size,
-readability-identifier-length,
-readability-magic-numbers,
-readability-named-parameter,
-readability-redundant-member-init,
-readability-uppercase-literal-suffix
WarningsAsErrors: "*"
HeaderFilterRegex: "\\./(archive|azm|browser|css|css2|dom|engine|etest|geom|gfx|html|html2|idna|img|js|layout|net|os|protocol|render|style|tui|type|unicode|uri|url|util|wasm)/"
CheckOptions:
# performance-move-const-arg
- key: performance-move-const-arg.CheckTriviallyCopyableMove
value: false
# readability-identifier-naming
# Classes, structs, ...
- key: readability-identifier-naming.NamespaceCase
value: lower_case
- key: readability-identifier-naming.ClassCase
value: CamelCase
- key: readability-identifier-naming.StructCase
value: CamelCase
- key: readability-identifier-naming.EnumCase
value: CamelCase
# Variables, member variables, ...
- key: readability-identifier-naming.ParameterCase
value: lower_case
- key: readability-identifier-naming.VariableCase
value: lower_case
- key: readability-identifier-naming.MemberCase
value: lower_case
- key: readability-identifier-naming.ProtectedMemberCase
value: lower_case
- key: readability-identifier-naming.ProtectedMemberSuffix
value: _
- key: readability-identifier-naming.PrivateMemberCase
value: lower_case
- key: readability-identifier-naming.PrivateMemberSuffix
value: _
# Functions, methods, ...
- key: readability-identifier-naming.FunctionCase
value: lower_case
- key: readability-identifier-naming.MethodCase
value: lower_case
# Constants
- key: readability-identifier-naming.ConstantCase
value: lower_case
- key: readability-identifier-naming.ConstexprVariablePrefix
value: k
- key: readability-identifier-naming.ConstexprVariableCase
value: CamelCase
- key: readability-identifier-naming.EnumConstantCase
value: CamelCase
# misc-non-private-member-variables-in-classes
- key: misc-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic
value: true