donglian2106 2017-08-19 20:34
浏览 99
已采纳

Golang的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

It is failing:

Error: could not find any viable formatter. available formatters: simplecov, lcov, coverage.py, clover, gocov, gcov, cobertura, jacoco

I have gocov installed. Also I generated a report with goconv:

gocov test -coverprofile=out

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

But had no luck...

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?

  • 写回答

2条回答 默认 最新

  • douji1058 2017-08-19 21:35
    关注

    Export var:

    CC_TEST_REPORTER_ID=...
    

    Run:

    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
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料