2

我们已将 OCLint 与以下脚本集成到我们的项目之一中。

source ~/.bash_profile
export PATH=$PATH:/usr/local/bin/

if [ -z "${SCHEME+x}" ]
then
export SCHEME="${PROJECT_NAME}"
fi

if [ -z "${WORKSPACE+x}" ]
then
export WORKSPACE="${PROJECT_NAME}.xcworkspace"
fi

cd "${SOURCE_ROOT}"

# Check if xctool and oclint are installed
if ! which -s xctool
then
echo 'error: xctool not found, install e.g. with homebrew'
exit 1
fi

if ! which -s oclint-json-compilation-database
then
echo 'error: OCLint not installed, install e.g. with homebrew cask'
exit 2
fi

# Cleanup before building
rm -f compile_commands.json
xctool -workspace "${WORKSPACE}" -scheme "${SCHEME}" clean > /dev/null

# Build and analyze
# OCLint Rule Index: http://docs.oclint.org/en/dev/rules/index.html
xctool -workspace "${WORKSPACE}" -scheme "${SCHEME}" -reporter json-compilation-database:compile_commands.json build
oclint-json-compilation-database -e Pods -- -max-priority-1=100000 -max-priority-2=100000 -max-priority-3=100000 \

# Final cleanup
rm -f compile_commands.json

尽管代码包含大量警告和错误,但它会给出“零”警告和“零”错误。

似乎它在旧 XCodes 上运行良好,但不适用于 XCode 9.2。

谁能告诉我们在 xcode 9.2 中完美运行 OCLint 需要哪些更改?

我们期望 xcode 在我们构建 OCLint 模式时会显示警告。但我们现在没有得到任何结果。

如果我们做错了什么,请指导我们。

4

1 回答 1

0

几天前,当我们使用 oclint 0.11 从 xcode 8.2.1 升级到 xcode 9.2 时,我们遇到了类似的挑战。您可以尝试升级到 oclint-0.13.1 并重试,看看是否有帮助。

还有其他一些调整,但不确定是否适合?

https://github.com/oclint/oclint/issues/245 (在文本中搜索 -fmodules 和 -gmodules,并删除所有匹配项。)

https://github.com/oclint/oclint/issues/302 (设置CLANG_ENABLE_MODULE_DEBUGGING=NO)

于 2018-02-09T05:46:12.457 回答