Using OCLint with xctool¶
This document goes through the happy path of using OCLint to analyze the code quality of a Xcode project with xctool.
xctool is a drop-in replacement for Apple’s
xcodebuild. It makes building Xcode projects much easier. It eases continuous integration in many ways as well.
xctool supports generating the report in JSON Compilation Database format, which can be used by OCLint to understand all the compiler flags in order to analyze the code.
Running xctool with json-compilation-database Reporter¶
xctool is quite straight forward. For example, the command below will build the project and generate the
compile_commands.json file under the current folder.
path/to/xctool.sh \ -project YourProject.xcodeproj \ -scheme YourScheme \ -reporter json-compilation-database:compile_commands.json \ build
xctool also supports an
.xctool-args file to preserve the command arguments, like workspace, scheme, configuration, etc. If we have
.xctool-args ready, then we could simply run
xctool -reporter json-compilation-database:compile_commands.json build
to get the
We can use
xctool clean to clean the build in order to have a full list of all compiling files the next time we call