Skip to content

Commit 4856615

Browse files
committed
style(cxx-cuda): add clang-tidy configuration
- Create .clang-tidy files for both C++ and CUDA project templates - Enable a comprehensive set of lint checks for code quality and style - Configure naming conventions for various identifier types - Set thresholds for function complexity and bug detection - Encourage modern C++ practices and core guidelines - Address security and performance concerns in the codebase
1 parent 37d3264 commit 4856615

File tree

2 files changed

+158
-0
lines changed

2 files changed

+158
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
Checks: >
2+
-*, # Disable all checks by default
3+
bugprone-*,
4+
readability-*,
5+
performance-*,
6+
modernize-*,
7+
cppcoreguidelines-*,
8+
clang-analyzer-*,
9+
portability-*,
10+
security-*,
11+
misc-*,
12+
google-*,
13+
14+
CheckOptions:
15+
# Naming conventions
16+
- key: readability-identifier-naming.ClassCase
17+
value: CamelCase
18+
- key: readability-identifier-naming.StructCase
19+
value: CamelCase
20+
- key: readability-identifier-naming.EnumCase
21+
value: CamelCase
22+
- key: readability-identifier-naming.MethodCase
23+
value: lower_case
24+
- key: readability-identifier-naming.FunctionCase
25+
value: lower_case
26+
- key: readability-identifier-naming.VariableCase
27+
value: lower_case
28+
- key: readability-identifier-naming.ParameterCase
29+
value: lower_case
30+
- key: readability-identifier-naming.MemberCase
31+
value: m_camelBack
32+
- key: readability-identifier-naming.StaticMemberCase
33+
value: s_camelBack
34+
- key: readability-identifier-naming.GlobalVariableCase
35+
value: g_lower_case
36+
- key: readability-identifier-naming.NamespaceCase
37+
value: lower_case
38+
39+
# Function complexity
40+
- key: readability-function-cognitive-complexity.Threshold
41+
value: 35
42+
43+
# Bug detection
44+
- key: bugprone-argument-comment
45+
value: 1
46+
- key: bugprone-branch-clone
47+
value: 1
48+
- key: bugprone-use-after-move
49+
value: 1
50+
51+
# Modern practices
52+
- key: modernize-use-nullptr.NullMacros
53+
value: 'NULL'
54+
- key: modernize-use-auto
55+
value: 1
56+
- key: modernize-avoid-bind
57+
value: 1
58+
59+
# Core guidelines
60+
- key: cppcoreguidelines-no-malloc
61+
value: 1
62+
- key: cppcoreguidelines-pro-type-cstyle-cast
63+
value: 1
64+
- key: cppcoreguidelines-special-member-functions
65+
value: 1
66+
67+
# Security
68+
- key: security-undefined-bool-conversion
69+
value: 1
70+
- key: security-implicit-int-float-conversion
71+
value: 1
72+
73+
# Performance
74+
- key: performance-unnecessary-copy-initialization
75+
value: 1
76+
- key: performance-for-range-copy
77+
value: 1
78+
- key: performance-move-const-arg
79+
value: 1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
Checks: >
2+
-*, # Disable all checks by default
3+
bugprone-*,
4+
readability-*,
5+
performance-*,
6+
modernize-*,
7+
cppcoreguidelines-*,
8+
clang-analyzer-*,
9+
portability-*,
10+
security-*,
11+
misc-*,
12+
google-*,
13+
14+
CheckOptions:
15+
# Naming conventions
16+
- key: readability-identifier-naming.ClassCase
17+
value: CamelCase
18+
- key: readability-identifier-naming.StructCase
19+
value: CamelCase
20+
- key: readability-identifier-naming.EnumCase
21+
value: CamelCase
22+
- key: readability-identifier-naming.MethodCase
23+
value: lower_case
24+
- key: readability-identifier-naming.FunctionCase
25+
value: lower_case
26+
- key: readability-identifier-naming.VariableCase
27+
value: lower_case
28+
- key: readability-identifier-naming.ParameterCase
29+
value: lower_case
30+
- key: readability-identifier-naming.MemberCase
31+
value: m_camelBack
32+
- key: readability-identifier-naming.StaticMemberCase
33+
value: s_camelBack
34+
- key: readability-identifier-naming.GlobalVariableCase
35+
value: g_lower_case
36+
- key: readability-identifier-naming.NamespaceCase
37+
value: lower_case
38+
39+
# Function complexity
40+
- key: readability-function-cognitive-complexity.Threshold
41+
value: 35
42+
43+
# Bug detection
44+
- key: bugprone-argument-comment
45+
value: 1
46+
- key: bugprone-branch-clone
47+
value: 1
48+
- key: bugprone-use-after-move
49+
value: 1
50+
51+
# Modern practices
52+
- key: modernize-use-nullptr.NullMacros
53+
value: 'NULL'
54+
- key: modernize-use-auto
55+
value: 1
56+
- key: modernize-avoid-bind
57+
value: 1
58+
59+
# Core guidelines
60+
- key: cppcoreguidelines-no-malloc
61+
value: 1
62+
- key: cppcoreguidelines-pro-type-cstyle-cast
63+
value: 1
64+
- key: cppcoreguidelines-special-member-functions
65+
value: 1
66+
67+
# Security
68+
- key: security-undefined-bool-conversion
69+
value: 1
70+
- key: security-implicit-int-float-conversion
71+
value: 1
72+
73+
# Performance
74+
- key: performance-unnecessary-copy-initialization
75+
value: 1
76+
- key: performance-for-range-copy
77+
value: 1
78+
- key: performance-move-const-arg
79+
value: 1

0 commit comments

Comments
 (0)