-
Notifications
You must be signed in to change notification settings - Fork 63
/
Copy path.clang-tidy
187 lines (187 loc) · 10 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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
---
Checks:
# enable everything first
- 'performance*'
- 'modernize*'
- 'readability*'
- 'clang-analyzer*'
- 'clang-diagnostic-*'
- 'bugprone*'
- 'misc*'
- 'core*'
- 'mpi*'
- 'cert-*'
- 'portability-*'
- 'google*'
- 'cppcoreguidelines-pro-type-cstyle-cast'
# then disable the stuff we don't want
- '-cert-dcl21-cpp' # returning non-const from operator-- or operator++
- '-cert-dcl50-cpp' # allow c-style variadics
# no reserved identifiers, both of these are aliased to bugprone-reserved-identifier,
# which we do enable. Leaving these enabled however, leads to needing to specify all
# three (bugprone-reserved-identifier, cert-dcl51-cpp, and cert-dcl37-c) in NOLINT lines
# which is a hassle. Since bugprone-reserved-identifier is enabled, the check still
# fires.
- '-cert-dcl51-cpp,-cert-dcl37-c,-cert-oop54-cpp'
- '-modernize-use-trailing-return-type'
- '-readability-function-cognitive-complexity'
- '-readability-implicit-bool-conversion'
- '-readability-braces-around-statements'
- '-readability-qualified-auto'
- '-readability-isolate-declaration'
- '-modernize-avoid-c-arrays'
- '-readability-named-parameter'
- '-readability-identifier-length'
- '-misc-non-private-member-variables-in-classes'
- '-bugprone-easily-swappable-parameters'
- '-bugprone-implicit-widening-of-multiplication-result'
- '-misc-include-cleaner'
- '-misc-header-include-cycle'
- '-modernize-macro-to-enum'
- '-misc-no-recursion'
# Generally speaking if something is static then it has an express reason to be. 99% of
# the candidates identified by this check were because they just so happened not to
# touch any member variables, not because they are logically static. So we disable the
# check.
- '-readability-convert-member-functions-to-static'
# When running in a conda env, ignore options that may have been added by conda but are unused
- '-clang-diagnostic-unused-command-line-argument'
# Given
#
# std::make_pair<some_type, some_other_type>(...)
#
# Results in: error: for C++11-compatibility, use pair directly. But we don't care about
# C++11, and so we don't care about this warning.
- '-google-build-explicit-make-pair'
# This check is incredibly expensive for absolutely no reason, and since we a) use
# modern google-test and b) don't have clang-tidy enabled on our testing code, we don't
# need to enable it!
- '-google-upgrade-googletest-case'
# This warning will warn if you have redundant default-initializers for class
# members. For example:
#
# class Foo
# {
# int x_{}; // WARNING: redundant initializer here
#
# public:
# Foo(int x) : x_{x} { }
# };
#
# Since Foo can only ever be constructed with an explicit value for x_ via its constructor,
# the default initializer is technically redundant. However, if we change the definition
# of Foo to now allow a default ctor, then the initializer becomes non-redundant
# again. It is easier to just follow the rule of "always explicitly default initialize
# members" than to remember to change 2 places at once.
- '-readability-redundant-member-init'
# Alias for readability-enum-initial-value, disable this one because the readability-
# name is easier to understand, and we don't want to silence 2 things for the same
# warning.
- '-cert-int09-c'
# This one is potentially controversial. This check warns when iterating over unordered
# containers of pointers:
#
# {
# int a = 1, b = 2;
# std::unordered_set<int *> set = {&a, &b};
#
# for (auto *i : set) { // iteration order not deterministic
# f(i);
# }
# }
#
# On the one hand, this is a clear case of non-determinism. But on the other hand, I
# feel it is obvious that a user does not care about the order of iteration
# because... they are using unordered containers!
- '-bugprone-nondeterministic-pointer-iteration-order'
WarningsAsErrors: '*'
HeaderFileExtensions:
- ''
- h
- hh
- hpp
- hxx
- cuh
- inl
ImplementationFileExtensions:
- c
- cc
- cpp
- cxx
- cu
HeaderFilterRegex: '.*/src/.*'
SystemHeaders: false
CheckOptions:
cert-dcl16-c.NewSuffixes: 'L;LL;LU;LLU'
cert-err33-c.CheckedFunctions: '::aligned_alloc;::asctime_s;::at_quick_exit;::atexit;::bsearch;::bsearch_s;::btowc;::c16rtomb;::c32rtomb;::calloc;::clock;::cnd_broadcast;::cnd_init;::cnd_signal;::cnd_timedwait;::cnd_wait;::ctime_s;::fclose;::fflush;::fgetc;::fgetpos;::fgets;::fgetwc;::fopen;::fopen_s;::fprintf;::fprintf_s;::fputc;::fputs;::fputwc;::fputws;::fread;::freopen;::freopen_s;::fscanf;::fscanf_s;::fseek;::fsetpos;::ftell;::fwprintf;::fwprintf_s;::fwrite;::fwscanf;::fwscanf_s;::getc;::getchar;::getenv;::getenv_s;::gets_s;::getwc;::getwchar;::gmtime;::gmtime_s;::localtime;::localtime_s;::malloc;::mbrtoc16;::mbrtoc32;::mbsrtowcs;::mbsrtowcs_s;::mbstowcs;::mbstowcs_s;::memchr;::mktime;::mtx_init;::mtx_lock;::mtx_timedlock;::mtx_trylock;::mtx_unlock;::printf_s;::putc;::putwc;::raise;::realloc;::remove;::rename;::scanf;::scanf_s;::setlocale;::setvbuf;::signal;::snprintf;::snprintf_s;::sprintf;::sprintf_s;::sscanf;::sscanf_s;::strchr;::strerror_s;::strftime;::strpbrk;::strrchr;::strstr;::strtod;::strtof;::strtoimax;::strtok;::strtok_s;::strtol;::strtold;::strtoll;::strtoul;::strtoull;::strtoumax;::strxfrm;::swprintf;::swprintf_s;::swscanf;::swscanf_s;::thrd_create;::thrd_detach;::thrd_join;::thrd_sleep;::time;::timespec_get;::tmpfile;::tmpfile_s;::tmpnam;::tmpnam_s;::tss_create;::tss_get;::tss_set;::ungetc;::ungetwc;::vfprintf;::vfprintf_s;::vfscanf;::vfscanf_s;::vfwprintf;::vfwprintf_s;::vfwscanf;::vfwscanf_s;::vprintf_s;::vscanf;::vscanf_s;::vsnprintf;::vsnprintf_s;::vsprintf;::vsprintf_s;::vsscanf;::vsscanf_s;::vswprintf;::vswprintf_s;::vswscanf;::vswscanf_s;::vwprintf_s;::vwscanf;::vwscanf_s;::wcrtomb;::wcschr;::wcsftime;::wcspbrk;::wcsrchr;::wcsrtombs;::wcsrtombs_s;::wcsstr;::wcstod;::wcstof;::wcstoimax;::wcstok;::wcstok_s;::wcstol;::wcstold;::wcstoll;::wcstombs;::wcstombs_s;::wcstoul;::wcstoull;::wcstoumax;::wcsxfrm;::wctob;::wctrans;::wctype;::wmemchr;::wprintf_s;::wscanf;::wscanf_s;'
llvm-else-after-return.WarnOnUnfixable: 'false'
cert-str34-c.DiagnoseSignedUnsignedCharComparisons: 'false'
cppcoreguidelines-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic: 'true'
google-readability-braces-around-statements.ShortStatementLines: '1'
llvm-qualified-auto.AddConstToQualified: 'false'
llvm-else-after-return.WarnOnConditionVariables: 'false'
cert-oop54-cpp.WarnOnlyIfThisHasSuspiciousField: 'false'
performance-move-const-arg.CheckTriviallyCopyableMove: 'false'
# The following is needed because clang tidy complains that TaskContext is always
# copied:
#
# class MyTask
# {
# // clang-tidy warning: ctx copied every time, but only used as a reference.
# // Consider making it a const reference
# void cpu_task(legate::TaskContext ctx)
# {
# ...
# }
# };
#
# But we can't do that, because the `task_wrapper` expects to find exactly the signature
# above. So we can either add `NOLINT` everywhere, or we can just ignore `TaskContext`
# copies wholesale (which is OK because they are just pimpls, and thus, very cheap to
# copy).
performance-unnecessary-value-param.AllowedTypes: 'legate::TaskContext'
performance-inefficient-vector-operation.VectorLikeClasses: '::std::vector;legate::tuple;legate::Shape'
performance-inefficient-string-concatenation.StrictMode: 'true'
readability-simplify-boolean-expr.ChainedConditionalReturn: 'true'
readability-simplify-boolean-expr.ChainedConditionalAssignment: 'true'
bugprone-dangling-handle.HandleClasses: 'legate::Span;::std::span'
bugprone-misplaced-widening-cast.CheckImplicitCasts: 'true'
bugprone-unused-return-value.AllowCastToVoid: 'true'
readability-enum-initial-value.AllowExplicitZeroFirstInitialValue: 'false'
readability-enum-initial-value.AllowExplicitSequentialInitialValues: 'false'
readability-redundant-access-specifiers.CheckFirstDeclaration: 'true'
bugprone-lambda-function-name.IgnoreMacros: 'true'
readability-identifier-naming.ClassCase: 'CamelCase'
readability-identifier-naming.UnionCase: 'CamelCase'
readability-identifier-naming.ClassConstantCase: 'UPPER_CASE'
readability-identifier-naming.ClassIgnoredRegexp: 'tuple|has_.*|is_.*|as_.*|.*_tag|tag|.*_of'
readability-identifier-naming.ConstantMemberCase: 'UPPER_CASE'
readability-identifier-naming.ConstantMemberIgnoredRegexp: 'value'
readability-identifier-naming.EnumCase: 'CamelCase'
readability-identifier-naming.EnumConstantCase: 'UPPER_CASE'
readability-identifier-naming.FunctionCase: 'lower_case'
# We want to allow legate::Shape SHAPE_4D()
readability-identifier-naming.FunctionIgnoredRegexp: '[A-Z_0-9]+'
readability-identifier-naming.GlobalConstantCase: 'UPPER_CASE'
readability-identifier-naming.GlobalConstantIgnoredRegexp: '.*_v'
readability-identifier-naming.LocalVariableCase: 'lower_case'
# We want to allow constexpr auto MY_VAL1
readability-identifier-naming.LocalVariableIgnoredRegexp: '[A-Z_0-9]+'
readability-identifier-naming.MacroDefinitionCase: 'UPPER_CASE'
# We want to allow MY_MACRO_PRIVATE_1_
readability-identifier-naming.MacroDefinitionIgnoredRegexp: '[A-Z_0-9]+'
readability-identifier-naming.NamespaceCase: 'lower_case'
readability-identifier-naming.PrivateMemberCase: 'lower_case'
readability-identifier-naming.PrivateMemberSuffix: '_'
readability-identifier-naming.PrivateMethodCase: 'lower_case'
readability-identifier-naming.PrivateMethodSuffix: '_'
readability-identifier-naming.ProtectedMemberCase: 'lower_case'
readability-identifier-naming.ProtectedMemberSuffix: '_'
readability-identifier-naming.ProtectedMethodCase: 'lower_case'
readability-identifier-naming.ProtectedMethodSuffix: '_'
readability-identifier-naming.PublicMethodCase: 'lower_case'
readability-identifier-naming.ScopedEnumCase: 'CamelCase'
readability-identifier-naming.ScopedEnumConstantCase: 'UPPER_CASE'
readability-magic-numbers.IgnoredIntegerValues: '0;1;2;3;4;5;6;7;8;9'
bugprone-suspicious-stringview-data-usage.AllowedCallees: 'legate::detail::ZStringView'
...