-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Expand file tree
/
Copy path.clang-tidy
More file actions
85 lines (85 loc) · 2.88 KB
/
.clang-tidy
File metadata and controls
85 lines (85 loc) · 2.88 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
# Reasoning
# =========
#
# Selection of Checks
# ------------------
#
# Selecting the following general purpose checks relevant for C code:
# - clang-analyzer-* ()
# - bugprone-*
# - readability-*
# - misc-*
#
# Additional checks for other languages or specific to projects/coding standards
# are not used, expected for the Linux kernel coding conventions, as the RIOT
# coding conventions builds upon the Linux coding conventions.
#
# Finally, the following checks are disabled:
# - bugprone-reserved-identifier:
# Too many false positives, as check does not take `static` declaration
# into account
# - bugprone-easily-swappable-parameters:
# This cannot be avoided
# - bugprone-too-small-loop-variable:
# Too many false positives
#
#
# Which Warnings to Raise to Errors
# ---------------------------------
#
# - bugprone-*:
# Avoiding known pitfalls or explicitly adding a magic comment and a
# reasoning for why sticking with a footgun should be doable
# - portability-*:
# Porability issues bite us hard due to the wide varity of board,
# toolchains, standard C libs, etc. we use. So we should avoid them
# where possible
#
#
# Fine Tuning
# -----------
#
# - readability-function-cognitive-complexity.IgnoreMacros: `true`:
# Otherwise the use of `DEBUG()` will be penalized, even though it
# helps both with debugging and with documenting the code.
# - readability-identifier-length:
# Disabled because of too many false positives.. E.g., `fd` for file
# descriptors or `id` for IDs will be flagged, but are sensible variables
# names when the scope is the function body
# - readability-magic-numbers:
# Disabled because of too many false positives. E.g. in
# ```
# size_t byte_pos = bitpos / 8;
# size_t byte_mask = 1U << (bitpos & 7);
# ```
# the numbers `8` and `7` are considered to be magic, but the code is
# still self-explanatory. Adding `#define BITS_PER_BYTE 8` and
# `#define BIT_POS_IN_BYTE_MASK 7` to silence the warning would not
# improve the readability here, but instead reduce it.
#
# Warning
# -------
#
# This configuration file is rather new and may enable a few warnings with a
# low signal-to-noise ratio are may not enable checks that would be exteremely
# helpful. If you modify this file to improve your experience, please consider
# upstreaming the changes.
---
Checks: "clang-analyzer-*,
bugprone-*,
portability-*,
readability-*,
misc-*,
linuxkernel-*,
-bugprone-reserved-identifier,
-bugprone-easily-swappable-parameters,
-readability-identifier-length,
-readability-magic-numbers
"
WarningsAsErrors: "bugprone-*,
portability-*,
"
HeaderFilterRegex: ''
FormatStyle: file
CheckOptions:
readability-function-cognitive-complexity.IgnoreMacros: 'true'