我正在尝试集成 OCLint 0.13 以检查基于 ObjC 的 iOS 项目中的 lint 违规情况。
根据本指南,我在 Xcode 中创建了一个聚合目标来运行 a,xcodebuild clean build
然后oclint-xcodebuild
生成一个compile_commands.json
. 我能够clang
从生成的compile_commands.json
文件中运行命令。oclint-json-compilation-database
但是,在由命令生成的 html 报告中,在处理类似 的文件时NEORepos/Public/ResourceObservables/NEOAggregatedObservable.h
,'NEOObservables/NEOObservable.h' file not found
即使上述头文件存在于NEOObservables/Public/Observables/NEOObservable.h
.
如何摆脱这些阻止我的某些源文件被检查的编译器错误?
compile_commands.json
从生成文件运行 clang 命令.o
,但 OCLint 似乎无法使用 json 文件进行编译。我还尝试添加更多-I
包含路径,但没有帮助。欢迎所有建议和指点。
这是一段(编辑过的)日志......
xcode_clean_build_command = xcodebuild -workspace 'Neo.xcworkspace' -scheme 'NeoSampleApp' -configuration 'Debug' clean build -dry-run -derivedDataPath /Users/username/Documents/git/ios-neo_linter/build/Neo -sdk iphonesimulator CLANG_ENABLE_MODULE_DEBUGGING=NO CODE_SIGNING_ALLOWED=NO CODE_SIGN_IDENTITY='' CODE_SIGNING_REQUIRED=NO ENABLE_BITCODE=NO COMPILER_INDEX_STORE_ENABLE=NO | 三通 xcodebuild.log
...
/oclint-xcodebuild
...
生成 compile_commands.json ...
选择 NEORepos/Public/ResourceObservables/NEOAggregatedObservable.m 选择 NeoSampleApp/main.m
...
用于 linting 的入围文件(283 个中的 2 个)并创建新的 compile_commands.json
...
编译/Users/username/Documents/git/ios-neo_linter/NEORepos/Public/ResourceObservables/NEOAggregatedObservable.m - 编译失败/Users/username/Documents/git/ios-neo_linter/NeoSampleApp/main.m - 成功分析/Users/用户名/Documents/git/ios-neo_linter/NeoSampleApp/main.m - 完成
...
正在生成 lint 报告(如果有)...
...
执行命令:oclint-json-compilation-database -e Pods -v -- -list-enabled-rules -no-analytics -enable-global-analysis -verbose --report-type html -o oclint.html -extra-arg =-Wno-一切
...
/usr/local/bin/oclint -p /Users/username/Documents/git/ios-neo_linter -list-enabled-rules -no-analytics -enable-global-analysis -verbose --report-type html -o oclint. html -extra-arg=-Wno-everything /Users/username/Documents/git/ios-neo_linter/NEORepos/Public/ResourceObservables/NEOAggregatedObservable.m /Users/username/Documents/git/ios-neo_linter/NeoSampleApp/main.m