Skip to content

Commit d0637c4

Browse files
committed
Improve clang-tidy
1 parent 53a5238 commit d0637c4

2 files changed

Lines changed: 46 additions & 41 deletions

File tree

.clang-tidy

Lines changed: 25 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,27 @@
1-
Checks: >
2-
clang-analyzer-*,
3-
bugprone-*,
4-
performance-*,
5-
readability-*,
6-
modernize-*,
7-
cppcoreguidelines-*,
8-
misc-*,
9-
-modernize-use-trailing-return-type,
10-
-modernize-use-auto,
11-
-modernize-use-using,
12-
-modernize-use-nodiscard,
13-
-cppcoreguidelines-macro-usage,
14-
-cppcoreguidelines-pro-bounds-pointer-arithmetic,
15-
-cppcoreguidelines-pro-type-union-access,
16-
-readability-function-cognitive-complexity,
17-
-llvmlibc-restrict-system-libc-headers,
18-
-llvmlibc-implementation-in-namespace,
19-
-altera-unroll-loops,
20-
-misc-definitions-in-headers,
21-
-readability-identifier-naming,
22-
-readability-identifier-length
1+
Checks:
2+
- '*'
3+
4+
FormatStyle: 'file'
5+
HeaderFilterRegex: '^(?!.*vulkan-renderer/build).*'
236

24-
WarningsAsErrors: ''
25-
HeaderFilterRegex: '.*\.(cpp|h)$'
26-
FormatStyle: file
27-
AnalyzeTemporaryDtors: true
287
CheckOptions:
29-
- key: modernize-loop-convert.MaxCopySize
30-
value: '16'
31-
- key: readability-identifier-naming.VariableCase
32-
value: camelBack
33-
- key: readability-identifier-naming.ClassCase
34-
value: CamelCase
35-
- key: readability-identifier-naming.FunctionCase
36-
value: camelBack
37-
- key: cppcoreguidelines-avoid-magic-numbers.IgnoreEnums
38-
value: '1'
39-
- key: cppcoreguidelines-avoid-magic-numbers.IgnoreOctalLiterals
40-
value: '1'
8+
- key: 'bugprone-argument-comment.CommentBoolLiterals'
9+
value: '0'
10+
- key: 'bugprone-assert-side-effect.AssertMacros'
11+
value: 'assert'
12+
- key: 'bugprone-dangling-handle.HandleClasses'
13+
value: 'std::basic_string_view;std::experimental::basic_string_view'
14+
- key: 'bugprone-dynamic-static-initializers.HeaderFileExtensions'
15+
value: ',h,hh,hpp,hxx'
16+
- key: 'bugprone-suspicious-string-compare.WarnOnImplicitComparison'
17+
value: '1'
18+
- key: 'cppcoreguidelines-explicit-virtual-functions.IgnoreDestructors'
19+
value: '1'
20+
- key: 'cppcoreguidelines-no-malloc.Allocations'
21+
value: '::malloc;::calloc'
22+
- key: 'google-readability-function-size.StatementThreshold'
23+
value: '800'
24+
- key: 'readability-identifier-naming.FunctionCase'
25+
value: 'lower_case'
26+
- key: 'readability-static-accessed-through-instance.NameSpecifierNestingThreshold'
27+
value: '3'

.github/workflows/static_code_analysis.yaml

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- name: Install dependencies
1616
run: |
1717
sudo apt update
18-
sudo apt install -y clang-15 clang-tidy-15 cmake ninja-build libc++-15-dev libc++abi-15-dev
18+
sudo apt install -y clang-15 clang-tidy-15 cmake parallel libc++-15-dev libc++abi-15-dev
1919
2020
- name: Set clang-tidy version
2121
run: echo "CLANG_TIDY=clang-tidy-15" >> $GITHUB_ENV
@@ -40,6 +40,24 @@ jobs:
4040
-DCMAKE_C_COMPILER=clang-15 \
4141
-DVMA_BUILD_SAMPLES=YES
4242
43-
- name: Run Clang-Tidy
43+
- name: Check the files found for clang-tidy
4444
run: |
45-
find . -path ./build -prune -o \( -name '*.cpp' -o -name '*.h' \) -print | xargs clang-tidy-15 -p build || true
45+
find src include \
46+
-path '*/_deps/*' -prune -o \
47+
-path '*/build/*' -prune -o \
48+
\( -name '*.cpp' -o -name '*.hpp' \) -print
49+
50+
- name: Run clang-tidy
51+
run: |
52+
find src include \
53+
-path '*/_deps/*' -prune -o \
54+
-path '*/build/*' -prune -o \
55+
\( -name '*.cpp' -o -name '*.hpp' \) -print0 |
56+
parallel -0 clang-tidy -p build {} |
57+
tee output || true
58+
59+
- name: Summarize clang-tidy warnings
60+
run: |
61+
grep -hEo '\[[a-z0-9]+-[a-z0-9-]+\]' output \
62+
| sort | uniq -c | sort -nr \
63+
| sed 's/[][]//g' || true

0 commit comments

Comments
 (0)