【发布时间】:2018-02-20 08:45:51
【问题描述】:
我正在尝试集成 OCLint 0.13 来检查我基于 ObjC 的 iOS 项目中的 lint 违规情况。
根据this guide,我在Xcode 中创建了一个聚合目标来运行xcodebuild clean build,然后是oclint-xcodebuild,以生成compile_commands.json。我可以从生成的compile_commands.json 文件中运行clang 命令。但是,在oclint-json-compilation-database 命令生成的html 报告中,在处理NEORepos/Public/ResourceObservables/NEOAggregatedObservable.h 之类的文件时,我会看到类似'NEOObservables/NEOObservable.h' file not found 的编译器错误,即使所述头文件存在于NEOObservables/Public/Observables/NEOObservable.h。。 p>
我怎样才能摆脱这些阻止我的一些源文件被检查的编译器错误?
从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 | tee 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/username/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-everything
...
/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
【问题讨论】:
标签: objective-c xcode xcodebuild oclint