Code Check#

Introduction to clang-tidy#

clang-tidy is a static analyzer for C and C++.

It has many checks and can help us find some potential bugs.

VG151 code quality checks#

Originally, I wrote a python script to perform the checks. It works quite good, but it fails for complicated cases.

Therefore, I spent some time writing a plugin for clang-tidy, and it works very well. It enables me to get AST of the code and I can match some specific code and traverse the tree.

Run checks on your program#

You can log into manuel’s server and we have already installed clang-tidy and my plugin for you.

Simply type:

clang-tidy --load=/usr/local/lib/libcodequality.so # add your source code

Checks we enabled#

The .clang-tidy file we enabled is included in the drone branch, materials repository.

Run clang-tidy with our checks locally#

If you want to perform the checks locally, you can use the prebuilt plugin on the Release page.

Contribution#

Go to Github repository, you can open PRs and issues.