Integrating Clang Static Analyzer

Jun 22, 2013

This feature is available for OCLint 0.8 and later versions.

Clang static analyzer is an awesome tool. Both Clang static analyzer and OCLint perform static code analysis, and we focus on the different aspects of the source code to ensure the quality of the code in various perspectives.

OCLint focuses on identifying code defects like metrics-based complicated code, code smells, bad programming practices, and so on. Based on the available checkers of Clang static analyzer, it shows its strength in ensuring the stability, security, and API usages of the code.

We hope OCLint can do the same as well, but instead of re-inventing the wheels, we would like to integrate Clang static analyzer’s results into OCLint’s reports. It largely broadens the functionalities, and it benefits the user experiences a lot - instead of maintaining two tools, now, users can use OCLint to get the expertises from both; the report format has been unified, it’s easier to understand the overall code quality analytics for the entire project from one report.

To tell OCLint to invoke Clang static analyzer along the process, the only thing needs to be done is to simply pass -enable-clang-static-analyzer flag, it’s painless.

Notice that, by invoking Clang static analyzer, it will significantly increase the total analysis time. So use it wisely.