OCLint与Xcode空报告

时间:2015-05-26 08:13:40

标签: ios iphone xcode oclint

我正在努力让OCLint使用iOS项目。我已经使用Brew安装了OCLint并且安装正确(我可以通过运行oclint命令检入终端)。

我尝试通过创建单独的目标(tutorial here)并创建新的运行脚本来集成它。当我构建新目标时,它会生成一个report.html文件,但它没有扫描文件,Total Files = 0:/

如何让它来扫描我的项目?非常感谢。

我的脚本如下:

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"

2 个答案:

答案 0 :(得分:0)

从您的终端试试。

echo "Opening workspace for OCLint detection"
open -a "/Applications/Xcode.app" PATH_TO_YOUR_WORKSPACE
sleep 20
echo "Starting OCLint Check......"
rm -Rf $(pwd)/compile_commands.json
rm -Rf $(pwd)/xcodebuild.log
xcodebuild -target TARGET -configuration Release -scheme OCLint -sdk iphonesimulator
xcodebuild -sdk iphonesimulator | tee xcodebuild.log
oclint-xcodebuild xcodebuild.log
oclint-json-compilation-database -- -o=report.html
oclint-json-compilation-database -v oclint_args "-report-type html -o report.html -rc=LONG_LINE=120" open compile_commands.json open report.html
echo "Finished executing OCLint..."
echo "Closing Xcode"
killall Xcode
exit 0

仅在未检测到您的方案时才打开和关闭Xcode。

答案 1 :(得分:0)

请尝试使用此命令终端。在您的路径目录中

xcodebuild -project DemoCustomOCLint.xcodeproj -arch i386 -sdk 
iphonesimulator11.0 | xcpretty -r json-compilation-database -o compile_commands.json

oclint-json-compilation-database -v -- -report-type html -o report777.html

oclint-json-compilation-database