-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.clang-tidy
More file actions
100 lines (98 loc) · 4.72 KB
/
Copy path.clang-tidy
File metadata and controls
100 lines (98 loc) · 4.72 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
UseColor: true
Checks:
- -*
- bugprone-*
# Too many warnings
- -bugprone-assignment-in-if-condition
# Too many warnings
- -bugprone-narrowing-conversions
# Kind of nonsense
- -bugprone-easily-swappable-parameters
# Too many warnings for now
- -bugprone-implicit-widening-of-multiplication-result
# Exception handling patterns in Nix
- -bugprone-empty-catch
# Many warnings
- -bugprone-unchecked-optional-access
# Many warnings, questionable lint
- -bugprone-branch-clone
# Extremely noisy before clang 19: https://github.com/llvm/llvm-project/issues/93959
- -bugprone-multi-level-implicit-pointer-conversion
# We don't compile out our asserts
- -bugprone-assert-side-effect
# TODO: figure out if this warning is useful
- -bugprone-exception-escape
# We use pointers to aggregates intentionally; void * would look weird
- -bugprone-sizeof-expression
#
# Checks disabled to pass on current codebase (can be progressively enabled):
#
# 11 warnings - optional value conversions in various places
- -bugprone-optional-value-conversion
# 4 warnings - switches without default cases
- -bugprone-switch-missing-default-case
# 4 warnings - string_view::data() usage patterns
- -bugprone-suspicious-stringview-data-usage
# 4 warnings - .cc files included in other files (intentional pattern)
- -bugprone-suspicious-include
# 2 warnings - unused return values (AllowCastToVoid helps but some remain)
- -bugprone-unused-return-value
# 2 warnings - unused local RAII-style variables
- -bugprone-unused-local-non-trivial-variable
# 2 warnings - returning const& from parameter
- -bugprone-return-const-ref-from-parameter
# 1 warning - signed char misuse
- -bugprone-signed-char-misuse
# 1 warning - calling parent virtual instead of override
- -bugprone-parent-virtual-call
# 1 warning - null termination issues
- -bugprone-not-null-terminated-result
# 1 warning - macro parentheses
- -bugprone-macro-parentheses
# 1 warning - increment/decrement in conditions
- -bugprone-inc-dec-in-conditions
# 2 warnings - sorts Value* by ->string_view(), not by pointer value (false positive)
- -bugprone-nondeterministic-pointer-iteration-order
# 9 warnings - intentional std::bit_cast/memcpy on Value* arrays (evaluator hot path)
- -bugprone-bitwise-pointer-cast
# 1 warning (header) - value.hh mkFailed: GC alloc in noexcept. Boehm's
# gc_cleanup::operator new isn't marked noexcept but aborts on OOM rather
# than throws; std::terminate here is the intended behavior anyway.
- -bugprone-unhandled-exception-at-new
# 1 warning (header) - fmt.hh Magenta<T>::operator<<: generic colorizer
# template; fires when T=unsigned char but that instantiation is correct.
- -bugprone-unintended-char-ostream-output
#
# Non-bugprone checks (some disabled to pass on current codebase):
#
# 4 warnings - exceptions not derived from std::exception
# All thrown exceptions must derive from std::exception
# - hicpp-exception-baseclass
# 88 warnings - C-style casts should be explicit about intent
# - cppcoreguidelines-pro-type-cstyle-cast
# 11 warnings - coroutine lambdas with captures (intentional pattern in async goal/store code)
# - cppcoreguidelines-avoid-capturing-lambda-coroutines
- performance-noexcept-swap
- performance-noexcept-move-constructor
- performance-noexcept-destructor
- performance-use-std-move
- misc-throw-by-value-catch-by-reference
- cppcoreguidelines-missing-std-forward
- android-cloexec-open
- android-cloexec-pipe2
# Custom nix checks (when added)
- nix-*
CheckOptions:
# __asan_default_options: ASAN runtime configuration function (see nix-meson-build-support/common/asan-options/)
# __wrap___assert_fail: Linker-wrapped assert handler for better stack traces (see nix-meson-build-support/common/assert-fail/)
# _SingleDerivedPathRaw, _DerivedPathRaw: Internal type aliases in derived-path.hh (leading underscore pattern)
# _SingleBuiltPathRaw, _BuiltPathRaw: Internal type aliases in built-path.hh (leading underscore pattern)
bugprone-reserved-identifier.AllowedIdentifiers: '__asan_default_options;__wrap___assert_fail;_SingleDerivedPathRaw;_DerivedPathRaw;_SingleBuiltPathRaw;_BuiltPathRaw'
# Allow explicitly discarding return values with (void) cast
bugprone-unused-return-value.AllowCastToVoid: true
bugprone-unsafe-functions.ReportDefaultFunctions: false
# Repurpose bugprone-unsafe-functions to lint functions that we'd want to wrap.
bugprone-unsafe-functions.CustomFunctions: >
::std::filesystem::create_directories, nix::createDirs, "Use nix::createDirs (it wraps exceptions)";
::std::filesystem::remove_all, nix::deletePath, "Use nix::deletePath (remove_all is not TOCTOU safe)";
ExtraArgs: ["-Werror=unnecessary-virtual-specifier"]