-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.clang-tidy
More file actions
73 lines (68 loc) · 3.87 KB
/
.clang-tidy
File metadata and controls
73 lines (68 loc) · 3.87 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
# Reasons
# -------
# A list of common reasons why certain specific lines are not linted (see source code)
#
# Reason 1
# This specific struct/define can be found buried under several stdlib/OS-dependent
# layers of header files, and it triggers the misc-include-cleaner check.
# The misc-include-cleaner check is useful and we don't want to disable it,
# but also including the specific header is cumbersome and not portable.
# Checks
# ------
# altera-id-dependent-backward-branch: it's ok to have ID-dependent loops, we have plenty of processing power and no safety critical system
# altera-struct-pack-align: it's just for performance, we don't need to optimize up to this level
# altera-unroll-loop: it's just for performance, we don't need to optimize up to this level
# bugprone-easily-swappable-parameters: loud warnings, with no clear advice on how to fix
# llvm-header-guard: warns when headers do not adhere to LLVM style, but this is not LLVM
# llvmlibc-restrict-system-libc-headers: this is a desktop application, libc is useful
# cppcoreguidelines*: this is a C application, not a C++ one
# readability-magic-numbers.IgnorePowersOf2IntegerValues: it's reasonable that powers of two can be pretty self-explanatory in an emulator
# readability-braces-around-statements: disabled because auto-formatting is already enough to save us from mistakes
# hicpp-signed-bitwise: disabled because produces false positives
# readability-magic-numbers.IgnoredIntegerValues: allow usage of immediate masks, after all this is an emulator
# concurrency-mt-unsafe: better to check for errors with strerror() and errno, instead of ignoring because functions are thread unsafe, don't you think?
# clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling: disabled because everybody needs memset()
# modernize-macro-to-enum: too much noise for harmless notation
# readability-avoid-unconditional-preprocessor-if: this is the only proper way to leave some stale, but useful code in the codebase, we can't have clang-tidy prohibit it
# readability-implicit-bool-conversion: explicit bool/int generates a lot of unnecessary boilerplate which actually impairs readability at this point
# readability-function-cognitive-complexity: difficult to decide a meaningful threshold, this has been chosen pretty random
# readability-magic-numbers: this is an emulator, we need magic numbers here and there, otherwise code will get too bloated
# readability-use-concise-preprocessor-directives: they were expanded because clang-tidy asked us to do so in a previous version, so it better shut up now
Checks: >
*,
-altera-id-dependent-backward-branch,
-altera-struct-pack-align,
-altera-unroll-loops,
-bugprone-easily-swappable-parameters,
-llvm-header-guard,
-llvmlibc-restrict-system-libc-headers,
-cppcoreguidelines*,
-google-readability-braces-around-statements,
-readability-braces-around-statements,
-hicpp-braces-around-statements,
-hicpp-signed-bitwise,
-android*,
-concurrency-mt-unsafe,
-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling,
-modernize-macro-to-enum,
-readability-avoid-unconditional-preprocessor-if,
-readability-implicit-bool-conversion,
-readability-magic-numbers,
-readability-use-concise-preprocessor-directives
CheckOptions:
- key: readability-magic-numbers.IgnorePowersOf2IntegerValues
value: true
- key: readability-magic-numbers.IgnoredIntegerValues
value: '255'
- key: readability-identifier-length.IgnoredVariableNames
value: 'c|fp|fd|ok|n'
- key: readability-identifier-length.IgnoredParameterNames
value: 'c'
- key: readability-function-cognitive-complexity.IgnoreMacros
value: true
- key: readability-function-cognitive-complexity.Threshold
value: 110
- key: misc-include-cleaner.IgnoreHeaders
value: "SDL3/.*;criterion/.*;sys/time.h"
- key: readability-implicit-bool-conversion.AllowLogicalOperatorConversion
value: true