forked from tier4/nebula
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.clang-tidy
More file actions
145 lines (141 loc) · 5.07 KB
/
.clang-tidy
File metadata and controls
145 lines (141 loc) · 5.07 KB
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
# All disabled checks have to come with an explanatory comment that states why they were disabled!
#
# bugprone-easily-swappable-parameters:
# Not always easily fixable, modern IDEs with parameter chips/hints help avoid this problem
#
# modernize-use-trailing-return-type:
# Purely stylistic, makes function signature longer
#
# readability-identifier-length:
# Things like std::ostream os; nlohmann::json j; are popular. Reviewer can decide on those cases
#
# readability-implicit-bool-conversion:
# Makes packet-parsing (bool field that occupies a byte or bitfield) annoying
#
# hicpp-special-member-functions:
# Alias for cppcoreguidelines-special-member-functions, which is enabled. If both are enabled,
# the CheckOptions below have to be specified twice.
#
# hicpp-braces-around-statements:
# Alias for readability-braces-around-statements, which is enabled. If both are enabled,
# the CheckOptions below have to be specified twice.
#
# hicpp-signed-bitwise:
# This rule is buggy and flags bitwise operators on bools.
Checks: "
*,
-abseil-*,
-altera-*,
-android-*,
-darwin-*,
-fuchsia-*,
-linuxkernel-*,
-llvmlibc-*,
-mpi-*,
-objc-*,
-zircon-*,
-bugprone-easily-swappable-parameters,
-modernize-use-trailing-return-type,
-readability-identifier-length,
-readability-implicit-bool-conversion,
-hicpp-special-member-functions,
-hicpp-braces-around-statements,
-hicpp-signed-bitwise"
# WarningsAsErrors have been taken from:
# https://github.com/autowarefoundation/autoware/blob/3591106/.clang-tidy-ci
WarningsAsErrors: "
bugprone-dangling-handle,
bugprone-fold-init-type,
bugprone-inaccurate-erase,
bugprone-incorrect-roundings,
bugprone-misplaced-widening-cast,
bugprone-sizeof-container,
bugprone-sizeof-expression,
bugprone-string-constructor,
bugprone-suspicious-enum-usage,
bugprone-suspicious-memset-usage,
bugprone-suspicious-missing-comma,
bugprone-suspicious-semicolon,
bugprone-swapped-arguments,
bugprone-unchecked-optional-access,
bugprone-unused-raii,
bugprone-use-after-move,
bugprone-assert-side-effect,
bugprone-bad-signal-to-kill-thread,
bugprone-copy-constructor-init,
bugprone-dynamic-static-initializers,
bugprone-exception-escape,
bugprone-integer-division,
bugprone-macro-parentheses,
bugprone-macro-repeated-side-effects,
bugprone-misplaced-operator-in-strlen-in-alloc,
bugprone-move-forwarding-reference,
bugprone-multiple-statement-macro,
bugprone-not-null-terminated-result,
bugprone-parent-virtual-call,
bugprone-posix-return,
bugprone-signed-char-misuse,
bugprone-string-literal-with-embedded-nul,
bugprone-suspicious-string-compare,
bugprone-terminating-continue,
bugprone-throw-keyword-missing,
bugprone-too-small-loop-variable,
bugprone-undefined-memory-manipulation,
bugprone-undelegated-constructor,
bugprone-unhandled-self-assignment,
bugprone-unused-return-value,
bugprone-virtual-near-miss,
cppcoreguidelines-slicing,
cppcoreguidelines-special-member-functions,
cppcoreguidelines-pro-bounds-constant-array-index,
cppcoreguidelines-virtual-class-destructor,
cppcoreguidelines-init-variables,
cppcoreguidelines-narrowing-conversions,
google-build-explicit-make-pair,
google-build-namespaces,
google-explicit-constructor,
misc-non-copyable-objects,
misc-throw-by-value-catch-by-reference,
misc-definitions-in-headers,
misc-new-delete-overloads,
misc-redundant-expression,
misc-unconventional-assign-operator,
misc-uniqueptr-reset-release,
performance-inefficient-algorithm,
performance-move-const-arg,
performance-move-constructor-init,
performance-noexcept-move-constructor,
readability-simplify-boolean-expr"
HeaderFilterRegex: ^(?!\/usr)(?!\/opt)
FormatStyle: file
CheckOptions:
- key: readability-identifier-naming.NamespaceCase
value: lower_case
- key: readability-identifier-naming.ClassCase
value: CamelCase
- key: readability-identifier-naming.PrivateMemberSuffix
value: _
- key: readability-identifier-naming.StructCase
value: CamelCase
- key: readability-identifier-naming.FunctionCase
value: lower_case
- key: readability-identifier-naming.VariableCase
value: lower_case
- key: readability-identifier-naming.GlobalConstantCase
value: lower_case
- key: readability-identifier-naming.GlobalConstantPrefix
value: g_
- key: readability-identifier-naming.ConstexprVariableCase
value: lower_case
- key: cppcoreguidelines-special-member-functions.AllowSoleDefaultDtor
value: true
# Structs (e.g. sensor config) with functions like to_json() would otherwise be flagged as warnings
- key: misc-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic
value: true
# Reduce boilerplate for things like guard clauses
- key: readability-braces-around-statements.ShortStatementLines
value: 2 # The definition is confusing, but everything >= 2 is flagged as a warning
# Macros like RCLCPP_INFO contribute large amounts to cognitive complexity, even if the
# containing function is simple.
- key: readability-function-cognitive-complexity.IgnoreMacros
value: true