问题
执行
oclint-json-compilation-database -e Pods -- -report-type html -rc LONG_LINE=9999 -max-priority-1=9999 -max-priority-2=9999 -max-priority-3=9999
之后出现如下:
20 errors generated.
20 errors generated.
20 errors generated.
20 errors generated.
20 errors generated.
20 errors generated.
1 error generated.
无法生成html解析文档.
解决方法
- 打开Xcode,在项目的 TARGETS 下面,点击下方的 “+” ,选择 cross-platform 下面的 Aggregate。输入名字,这里命名为 Lint
- 选择对应的 TARGET -> lint。在 Build Phases 下 Run Script 下写下面的脚本代码.
source ~/.bash_profile
cd ${SRCROOT}
xcodebuild clean
xcodebuild | xcpretty -r json-compilation-database
oclint-json-compilation-database -e Pods -- -report-type xcode
-rc LONG_LINE=200
-rc LONG_VARIABLE_NAME=30
-disable-rule ShortVariableName
-max-priority-1=100000
-max-priority-2=100000
-max-priority-3=100000
如图:
然后, Cmd + B , 项目运行后分析成功!