0

我正在尝试集成 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

4

1 回答 1

0

编译器错误是由于-dry-run我使用的标志造成的。由于它是在进行试运行,因此它没有创建.hmap导致错误所需的文件(至少不在正确的位置)<blah>.h file not found

但是,如果没有-dry-run我将不得不进行完整的构建,这对我来说是不可接受的。如果我找到具有最佳性能的解决方案,将更新。

于 2018-03-02T19:00:08.557 回答