OCLint not in system path

房东的猫 提交于 2019-12-02 00:04:58

You can download oclint from : http://archives.oclint.org/nightly/oclint-0.9.dev.02251e4-x86_64-darwin-14.0.0.tar.gz

To integarte into your xcode project u could use this link :http://docs.oclint.org/en/dev/guide/xcode.html

Below is the script I am using to generate html file.

OCLINT_HOME is the path for oclint downloaded folder. I have renamed the folder to oclintrelease.

OCLINT_HOME=/Users/Dheeraj/Downloads/oclintrelease
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"

Your report would be generated to the provided path in OCLINT_HOME using the above script.

If you want to generate report in your derived data folder then replace the last line with :

oclint-json-compilation-database -v oclint_args "-report-type html -o report.html"

HTML report would be generated if and only if your build is successful and you can check your generated report path and script report into Log Navigator of Xcode.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!