5. Tooling¶
In Kagome we use certain set of tools to assure code quality. Here is a list, and guide how to use them.
5.1. clang-tidy¶
Set of rules is specified at root .clang-tidy
file.
5.1.1. Configure + Build + Run clang-tidy (slow)¶
Ensure clang-tidy is in PATH
mkdir build
cd build
cmake .. -DCLANG_TIDY=ON
make
Warnings/errors will be reported to stderr, same as compiler warnings/errors.
5.1.2. Run clang-tidy for changes between your branch and master¶
Ensure
clang-tidy
is in PATHEnsure
clang-tidy-diff.py
is in PATH.on Mac it is usually located at
/usr/local/Cellar/llvm/8.0.0_1/share/clang/clang-tidy-diff.py
(note, 8.0.0_1 is your version, it may be different).on Linux it is usually located at
/usr/lib/llvm-8/share/clang/clang-tidy-diff.py
mkdir build
cd build
cmake ..
make generated
- this step creates generated headers (protobuf, etc)cd ..
housekeeping/clang-tidy-diff.sh
5.2. Toolchain build¶
When CMAKE_TOOLCHAIN_FILE is specified, then specific toolchain is used. Toolchain is a cmake file, which sets specific variables, such as compiler, its flags, build mode, language standard.
Example:
mkdir build
cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchain/gcc-8_cxx17.cmake
All dependencies will be built with gcc-8 and cxx17 standard.
Default toolchain is cxx17.cmake
. List of toolchains.
Also, sanitizers can be enabled with use of toolchains, so all dependencies will be built with specified sanitizer.
5.3. coverage¶
Coverage is calculated automatically by Jenkins (CI).
We use codecov to display coverage.