2015-05-26 42 views
1

我想获得OCLint iOS项目的工作。我已经使用Brew安装了OCLint并且它已经正确安装(我可以通过运行oclint命令来检查终端)。OCLint与Xcode空报告

我试图通过创建一个单独的目标(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" 
+0

你试过用oclint 0.9吗?你也可以显示你得到的构建消息。 –

回答

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。

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