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