OCLint快速接入

環(huán)境搭建:

brew cask install oclint

brew cask installxcpretty

oclint檢測代碼

$xcodebuild \

-workspace TALAccSDK.xcworkspace \

-scheme TALAccSDK \

-configuration Debug build \?

| xcpretty \ #使用xcpretty將編譯結(jié)果輸出成后面需要的.json文件

-r json-compilation-database \

-o compile_commands.json

xcodebuild -workspace TALAccSDK.xcworkspace clean -scheme TALAccSDK -configuration Debug build | xcpretty -r json-compilation-database -o compile_commands.json

注:如果使用了clean命令,會(huì)清理編譯緩存,本次操作需重新進(jìn)行編譯

$xcodebuild -workspace name.xcworkspace clean

oclint-json-compilation-database 轉(zhuǎn)換.json文件為.html

$oclint-json-compilation-database \

-e Pods -- \

-report-type html \

-o oclintresult.html \

-rc LONG_LINE=9999 \ #添加一個(gè)檢查規(guī)則:最長行數(shù)邊界為9999,小于兩千才可以通過檢測:

-max-priority-1=9999 \

-max-priority-2=9999 \

-max-priority-3=9999

oclint-json-compilation-database -e Pods -- -report-type html -o oclintresult.html -rc LONG_LINE=9999 -max-priority-1=9999 -max-priority-2=9999 -max-priority-3=9999

報(bào)錯(cuò):

1、multiple jobs問題

oclint: error: one compiler command contains multiple jobs:xxxx

基本出現(xiàn)在初次運(yùn)行oclint或者使用了clean命令,清除了編譯緩存之后,會(huì)出現(xiàn)下面的錯(cuò)誤:

找到了一種解決方式:oclint: error: one compiler command contains multiple jobs解決方式

(更多依賴內(nèi)容參考OCLint-內(nèi)容擴(kuò)展頁面)

post_install do |installer|

????installer.pods_project.targets.each do |target|

????????target.build_configurations.each do |config|

config.build_settings['COMPILER_INDEX_STORE_ENABLE']= "NO"

????????end

????end

end

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容