Task #3837
open
Investigate clang-tidy usage to enforce coding standards
Added by Roland Fischer over 4 years ago.
Updated 4 months ago.
Description
We shall investigate using clang-tidy to enforce coding style guide that cannot be done with clang-format. It can also be used to enforce some "best practices".
Limitation of clang-format is that it only reformats code. clang-tidy can be used to e.g. enforce "always use brace for if()".
What's the difference between scan-build and clang-tidy?¶
scan-build does static analysis of code and as such does flow-control and path analysis. Use it to help finding bugs.
clang-tidy provides linter-based checks only that is mostly used to enforce coding standards. It's only based on the AST afaik. It's fully configurable on what to check for.
clang-tidy can also be used to "fix the code for some checks", i.e. it's convenient to use clang-tidy to upgrade" a code base to certain standards, such as the "shall always use braces" in this example.FYI, scan-build is used as static analysis tool in private QA builds.
- Assignee set to Community Ticket
- Target version set to TBD
Also available in: Atom
PDF