我有一个目标-C iOS图书馆建在特拉维斯CI。我刚刚在我的.travis.yml
文件中启用了静态分析,它发现了一个问题(一个死商店),但是它并没有在Travis上的构建失败。下面是我的.travis.yml
中的相关行(为可读性而包装的行):
- set -o pipefail && xcodebuild analyze
-workspace Example/BonMot.xcworkspace
-scheme BonMot-Example
-destination 'name=iPhone 6' ONLY_ACTIVE_ARCH=NO | xcpretty
我需要做什么,以导致警告在这一行失败的建设特拉维斯CI?您可以在我的项目这里上看到相关的拉请求。
发布于 2016-11-01 01:34:01
在这篇博客文章的帮助下,我设法想出了一种方法来实现这个目标。下面是示例.travis.yml
文件的相关部分:
language: objective-c
rvm:
- 2.2.4
osx_image: xcode7.3
install:
- gem install xcpretty --no-rdoc --no-ri --no-document --quiet
- export PYTHONUSERBASE=~/.local
- easy_install --user scan-build
script:
# use scan-build with --status-bugs to fail the build for static analysis warnings per http://jonboydell.blogspot.ca/2013/02/clang-static-analysis.html
- export PATH="${HOME}/.local/bin:${PATH}" # I forget whether this was necessary. Try omitting it and see what happens!
- set -o pipefail && scan-build --status-bugs xcodebuild analyze -workspace MyWorkspace.xcworkspace -scheme MyScheme -destination 'name=iPhone 6' ONLY_ACTIVE_ARCH=NO | xcpretty
发布于 2016-09-22 09:57:46
只有使用详细的这里方法才能使其工作。
将这两个参数添加到xcodebuild
或scan -x
命令中
CLANG_ANALYZER_OUTPUT=plist-html \
CLANG_ANALYZER_OUTPUT_DIR="$(pwd)/clang"
如果有clang警告,这将生成一个HTML文件。所以检查这个文件的存在。
if [[ -z `find clang -name "*.html"` ]]; then
echo "Static Analyzer found no issues"
else
echo "Static Analyzer found some issues"
exit 123
fi
发布于 2016-03-26 12:04:45
我认为您希望将-Wunused-value
添加到构建设置的其他警告标志部分,并将“将警告视为错误”设置为“是”。
https://stackoverflow.com/questions/36231446
复制相似问题