问题描述
Codeclimate文档编写了如何指定coverage格式化程序.但是,当我尝试将覆盖范围发送给Codeclimate时:
Nowhere in Codeclimate docs written how to specify coverage formatter. But when I'm trying to send coverage to Codeclimate:
./cc-test-reporter before-build
./cc-test-reporter after-build
失败:
我已经安装了 gocov
.我也用 goconv
生成了一份报告:
I have gocov
installed. Also I generated a report with goconv
:
gocov test -coverprofile=out
然后我尝试通过多种方式将报告文件指定为Codeclimate:
And I tried to specify the report file to Codeclimate in various ways:
./cc-test-reporter after-build out
./cc-test-reporter after-build < out
但是没有运气...
我没有找到与 .codeclimate.yml
文件相关的与格式程序有关的指令.该文档以超级您知道"的风格编写,因此无济于事.如何使用Codeclimate启用/发送测试覆盖率?
I haven't found any formatter related directives for .codeclimate.yml
file. The doc is written in super "you know" style so it didn't help. How to enable/send test coverage with Codeclimate?
推荐答案
导出var:
CC_TEST_REPORTER_ID=...
运行:
for pkg in $(go list ./... | grep -v vendor); do
go test -coverprofile=$(echo $pkg | tr / -).cover $pkg
done
echo "mode: set" > c.out
grep -h -v "^mode:" ./*.cover >> c.out
rm -f *.cover
./cc-test-reporter after-build
这篇关于Golang的Codeclimate测试覆盖率格式化程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!