clang-tidy: propose a base .clang-tidy

When there is a specific recommendation, it is taken from Cpp Core
guidelines [1] or clang-tidy defaults.

- readability-function-size.LineThreshold
  was chosen to support
  [ F.3 Keep functions short and simple ]

  They recommend 60 lines to flag functions which would not fit on a
  screen.

- readability-function-size.ParameterThreshold
  was chosen to support
  [ F.2: A function should perform a single logical operation ]

  They recommend to be suspicious of functions with 7 or more
  parameters.

- readability-function-cognitive-complexity.Threshold
  was chosen to support
  [ F.3: Keep functions short and simple ]

  They recommend a cyclomatic complexity of 10 or less.
  However, cyclomatic complexity is not implemented in clang-tidy,
  therefore going with the clang-tidy default.

What is the goal of this change?

- making it easier for people to read the code.

- making it easier to perform refactorings without breaking stuff

- making it easier to review changes

Who will be responsible for making the required changes?

- Everyone who is interested. The plan is to atleast get some of the
  most important pieces into a more readable state. Examples are
  dbus-sensors, entity-manager, x86-power-control.

- The plan is to enable some of these checks as errors once a repo
  comes into compliance. After that, contributors will be responsible
  to ensure their changes meet these checks.

Tradeoffs:

- There might be more code overall, as functions will be smaller.
- People might be required to do another (refactoring) iteration on
  their changes if some of these checks become hard errors.
- Refactoring code to meet these checks might introduce bugs.

[1] https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines

Change-Id: Icbdd55d2f672037a57d8ed08d52b20427e9e1e4f
Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>
1 file changed
tree: fcfe22c820ee38cfa567051456fa5a11473bcb5d
  1. architecture/
  2. designs/
  3. development/
  4. logo/
  5. process/
  6. release/
  7. security/
  8. style/
  9. testing/
  10. tof/
  11. userguide/
  12. .markdownlint.yaml
  13. .prettierrc.yaml
  14. anti-patterns.md
  15. cheatsheet.md
  16. code-of-conduct.md
  17. community-membership.md
  18. console.md
  19. CONTRIBUTING.md
  20. cpp-style-and-conventions.md
  21. features.md
  22. glossary.md
  23. host-management.md
  24. IPMITOOL-cheatsheet.md
  25. kernel-development.md
  26. LICENSE
  27. maintainer-workflow.md
  28. Makefile
  29. meta-layer-guidelines.md
  30. openbmc-conversion.md
  31. OWNERS
  32. README.md
  33. REDFISH-cheatsheet.md
  34. rest-api.md
  35. REST-cheatsheet.md
  36. SECURITY.md
  37. subtree.md
  38. yocto-development.md
README.md

OpenBMC documentation

The OpenBMC project is a Linux Foundation project whose goal is to produce a customizable, open-source firmware stack for Baseboard Management Controllers (BMCs). This repository contains documentation for OpenBMC as a whole. There may be component-specific documentation in the repository for each component.

The features document lists the project's major features with links to more information.

Contact

OpenBMC Development

These documents contain details on developing OpenBMC code itself

OpenBMC Usage

These documents describe how to use OpenBMC, including using the programmatic interfaces to an OpenBMC system.