I'm trying to get OCLint working with a iOS project. I've installed OCLint using Brew and it has installed correctly (I can check in terminal by running the oclint command).
I've attempted to integrate it by creating a separate target (tutorial here) and creating a new run script. When I build the new target it generates a report.html file but it has no files scanned, Total Files = 0 :/
How can I get it to scan my project? Many thanks.
My script is below:
OCLINT_HOME=/Users/johndoe/Documents/Programs/oclint-0.8.1
export PATH=$OCLINT_HOME/bin:$PATH
hash oclint &> /dev/null
if [ $? -eq 1 ]; then
echo >&2 "oclint not found, analyzing stopped"
exit 1
fi
cd ${TARGET_TEMP_DIR}
if [ ! -f compile_commands.json ]; then
echo "[*] compile_commands.json not found, possibly clean was performed"
echo "[*] starting xcodebuild to rebuild the project.."
# clean previous output
if [ -f xcodebuild.log ]; then
rm xcodebuild.log
fi
cd ${SRCROOT}
xcodebuild clean
#build xcodebuild.log
xcodebuild | tee ${TARGET_TEMP_DIR}/xcodebuild.log
#xcodebuild <options>| tee ${TARGET_TEMP_DIR}/xcodebuild.log
echo "[*] transforming xcodebuild.log into compile_commands.json..."
cd ${TARGET_TEMP_DIR}
#transform it into compile_commands.json
oclint-xcodebuild
fi
echo "[*] starting analyzing"
cd ${TARGET_TEMP_DIR}
oclint-json-compilation-database -v oclint_args "-report-type html -o $OCLINT_HOME/report.html"
Try this from your terminal.
Open and close Xcode only if your scheme is not getting detected.