OGeek|极客世界-中国程序员成长平台

标题: ios - OCLint 不在系统路径中 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-13 10:44
标题: ios - OCLint 不在系统路径中

我有一个 Xcode 项目。我试图在其中集成 OcLint 。但它说没有 OCLint。如何下载并将OCLint 添加到我的系统路径,以便我可以将OCLint 集成到我的 xcode 项目中。

编辑:

当我将 OCLint 脚本的一部分作为

hash oclint &> /dev/null
if [ $? -eq 1 ]; then
echo >&2 "oclint not found, analyzing stopped"
exit 1
fi

它给出oclint not found,正在分析停止

请给我一个解决方案。



Best Answer-推荐答案


您可以从 http://archives.oclint.org/nightly/oclint-0.9.dev.02251e4-x86_64-darwin-14.0.0.tar.gz 下载 oclint

要集成到您的 xcode 项目中,您可以使用此链接:http://docs.oclint.org/en/dev/guide/xcode.html

下面是我用来生成 html 文件的脚本。

OCLINT_HOME 是 oclint 下载文件夹的路径。我已将文件夹重命名为 oclintrelease。

OCLINT_HOME=/Users/Dheeraj/Downloads/oclintrelease
export PATH=$OCLINT_HOME/binPATH

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"

您的报告将使用上述脚本生成到 OCLINT_HOME 中提供的路径。

如果您想在派生数据文件夹中生成报告,请将最后一行替换为:

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

当且仅当您的构建成功并且您可以将生成的报告路径和脚本报告检查到 Xcode 的 Log Navigator 时,才会生成 HTML 报告。

关于ios - OCLint 不在系统路径中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30052686/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://jike.in/) Powered by Discuz! X3.4