This repository will contain an overview of tooling support to enforce and check against the CppCoreGuidelines.
This is not a clone of the Guidelines, but a helpful enhancement.
The document is structured similarly to the Guidelines, with each subsection being seperate. Since not every rule is enforceable by tools, some rules will not be mentioned here, to reduce the noise.
P: Philosophy
I: Interfaces
F: Functions
C: Classes and class hierarchies
Enum: Enumerations
R: Resource Management
ES: Expressions and statements
Per: Performance
CP: Concurrency
E: Error handling
Con: Constants and immutability
T: Templates and generic programming
CPL: C-style programming
just use C++ Compiler
SF: Source Files
SL: The standard library currently a bit messy?
Pro: Profiles
NL: Naming and layout
So which tools am I talking about?
They aim to give a tool for all tasks, clang-tidy and clang-format are the most useful right now.
- clang-format
- clang-tidy
- clang static analyzer - can be called from clang-tidy!
- list of clangs sanitizer - this is compiler related, note that gcc implements some sanitizers as well!
Each of these tools gets it own overview page, and a general overview what is possible to check with any tool.
The detail pages will contain more information, like the ability to automatically fix issues, like clang-tidy
does.
To use clang-tidy
copy one of the clang-tidy-<version>
to your repository
and name it as .clang-tidy
. It will enable all checks that enforce the
guidelines. You can further modify the checks as well.
cppcheck
is a static analyzer that implements a lot of useful checks.
CppCoreCheck
is a static analysis tool provided by Microsoft and useable in
Visual Studio. It partially implements the CppCoreGuidelines
but is Microsoft
specific.
An introduction is provided in the officical docs as well as a list of checks.
This section gives an overview of the Implementation status for the
CppCoreGuidelines in several analysis tools. Most of them are clang
based and
clang-tidy
has most of the checks implemented.
/partial/done/todo/enforceable/ (/12/111/168/291/) 38.14% enforced, 42.26% addressed
/partial/done/todo/enforceable/ (/0/23/44/67/) 34.32% enforced, 34.32% addressed
/partial/done/todo/enforceable/ (/0/2/10/12/) 16.66% enforced, 16.66% addressed
/partial/done/todo/enforceable/ (/1/2/2/5/) 40.00% enforced, 60.00% addressed
/partial/done/todo/enforceable/ (/0/1/6/7/) 14.28% enforced, 14.28% addressed
/partial/done/todo/enforceable/ (/1/3/3/7/) 42.85% enforced, 57.14% addressed
/partial/done/todo/enforceable/ (/0/24/36/60/) 40.00% enforced, 40.00% addressed
/partial/done/todo/enforceable/ (/3/12/14/29/) 41.37% enforced, 51.72% addressed
/partial/done/todo/enforceable/ (/1/3/7/11/) 27.27% enforced, 36.36% addressed
/partial/done/todo/enforceable/ (/0/8/5/13/) 61.53% enforced, 61.53% addressed
/partial/done/todo/enforceable/ (/0/0/1/1/) 0% enforced, 0% addressed
/partial/done/todo/enforceable/ (/6/0/3/9/) 0% enforced, 66.66% addressed
/partial/done/todo/enforceable/ (/0/2/1/3/) 66.66% enforced, 66.66% addressed
/partial/done/todo/enforceable/ (/0/17/4/21/) 80.95% enforced, 80.95% addressed
/partial/done/todo/enforceable/ (/0/2/8/10/) 20.00% enforced, 20.00% addressed
/partial/done/todo/enforceable/ (/0/4/24/28/) 14.28% enforced, 14.28% addressed