我们已将 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 模式时会显示警告。但我们现在没有得到任何结果。
如果我们做错了什么,请指导我们。