2015-05-26 43 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