-
Notifications
You must be signed in to change notification settings - Fork 213
/
.clang-tidy
107 lines (103 loc) · 4.01 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
---
# Configurations for clang-tidy
#
# To use clang-tidy, you have to install it.
#
# (1) On Ubuntu, you can install it by
#
# sudo apt-get install -y clang-tidy-9
#
# (2) On macOS, you can install it by
#
# brew install llvm
# export PATH=$(brew --prefix llvm)/bin:${PATH}
#
# clang-tidy-9 -dump-config
# can be used to show the current configuration for clang-tidy
#
# To run clang-tidy for k2, use
#
# mkdir build
# cd build
# cmake ..
# cd ..
# clang-tidy-9 -p build k2/csrc/*.cc
#
# ------------------------------------------------------------
# Explanations for disabled checks
# ------------------------------------------------------------
# -google-readability-braces-around-statements
# We do not use braces for single `if` statement.
#
# -modernize-use-trailing-return-type
# We do not use trailing return type in most lambda functions.
#
# -cppcoreguidelines-special-member-functions
# -cppcoreguidelines-owning-memory
# Disable warnings in googletest's `TEST()`
#
# -google-runtime-references
# -cppcoreguidelines-pro-type-vararg
# -cppcoreguidelines-pro-bounds-pointer-arithmetic
# Disable warnings in the pybind code for k2.
#
# -cppcoreguidelines-non-private-member-variables-in-classes
# We have public members for `struct`
Checks: >
-*,
bugprone-*,
clang-analyzer-*,
google-*,
-google-readability-braces-around-statements,
-google-runtime-references,
cppcoreguidelines-*,
-cppcoreguidelines-avoid-c-arrays,
-cppcoreguidelines-avoid-magic-numbers,
-cppcoreguidelines-macro-usage,
-cppcoreguidelines-no-malloc,
-cppcoreguidelines-non-private-member-variables-in-classes,
-cppcoreguidelines-owning-memory,
-cppcoreguidelines-pro-bounds-pointer-arithmetic,
-cppcoreguidelines-pro-type-const-cast,
-cppcoreguidelines-pro-type-member-init,
-cppcoreguidelines-pro-type-reinterpret-cast,
-cppcoreguidelines-pro-type-vararg,
-cppcoreguidelines-special-member-functions,
modernize-*,
-modernize-avoid-c-arrays,
-modernize-deprecated-headers,
-modernize-use-default-member-init,
-modernize-use-trailing-return-type,
readability-*,
-readability-braces-around-statements,
-readability-isolate-declaration,
-readability-magic-numbers,
-readability-static-definition-in-anonymous-namespace,
-readability-uppercase-literal-suffix,
performance-*,
HeaderFilterRegex: "k2/csrc/.*"
# TODO(fangjun): when to enable this?
#
# If it is uncommented, it will treat warnings as errors.
# WarningsAsErrors: "*"
# refer to
# https://clang.llvm.org/extra/clang-tidy/checks/readability-identifier-naming.html#readability-identifier-naming
CheckOptions:
- { 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.TemplateParameterCase, value: CamelCase }
- { key: readability-identifier-naming.FunctionCase, value: CamelCase }
- { key: readability-identifier-naming.VariableCase, value: lower_case }
- { key: readability-identifier-naming.ClassMemberCase, value: lower_case }
- { key: readability-identifier-naming.EnumConstantCase, value: CamelCase }
- { key: readability-identifier-naming.EnumConstantPrefix, value: k }
- { key: readability-identifier-naming.ConstexprVariableCase, value: CamelCase }
- { key: readability-identifier-naming.ConstexprVariablePrefix, value: k }
- { 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.StaticConstantCase, value: CamelCase }
- { key: readability-identifier-naming.StaticConstantPrefix, value: k }
...