xref: /openbmc/docs/style/cpp/tidy-desired.md (revision ba560cc31297caddfc157c540ae9e6d760d630e5)
1# Desired clang-tidy checks
2
3The following file contains checks and settings that the project would like to
4enable, but has had trouble either in engineering or has other higher priority
5rework. There is general agreement that the below checks _should_ be useful, but
6have not concretely enabled them across the project.
7
8```yaml
9Checks: "-*, readability-function-size,
10  readability-function-cognitive-complexity
11  "
12
13CheckOptions:
14  - key: readability-function-size.LineThreshold
15    value: 60 # [1]
16  - key: readability-function-size.ParameterThreshold
17    value: 6 # [2]
18  - key: readability-function-cognitive-complexity.Threshold
19    value: 25 # [3]
20
21# [1] https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#f3-keep-functions-short-and-simple
22# [2] https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#f2-a-function-should-perform-a-single-logical-operation
23# [3] https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#f3-keep-functions-short-and-simple
24# However cognitive complexity != cyclomatic complexity. Therefore using the clang-tidy default value,
25# as cyclomatic complexity seems to not be implemented in clang-tidy.
26
27# [1],[2],[3] do not have to be enforced or applied project-wide yet.
28```
29