Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coveralls branch percentage bug? #96

Closed
dougwilson opened this issue Aug 10, 2018 · 13 comments
Closed

Coveralls branch percentage bug? #96

dougwilson opened this issue Aug 10, 2018 · 13 comments

Comments

@dougwilson
Copy link

I'm not sure if this is a bug in badgen or Coveralls API, but shields.io seems to be returning the expected 100% while badgen seems to be using a percentage from a recent PR.

Badgen URL: https://flat.badgen.net/coveralls/c/github/expressjs/morgan/master
shields.io URL: https://img.shields.io/coveralls/expressjs/morgan/master.svg?style=flat-square

Rendered:
Badgen:
shields.io:

@amio
Copy link
Member

amio commented Aug 10, 2018

Hmm 🤔

For master branch, this api
https://coveralls.io/github/expressjs/morgan.json?branch=master returns 99.13 (right now),

And the "default" endopoint:
https://coveralls.io/github/expressjs/morgan.json returns 99.15 (right now)

@dougwilson
Copy link
Author

I mostly expected it was going tot be a bug in the Coveralls API. Not sure how shields.io is getting 100% (it's possible they have it cached maybe -- though the build the lower % is from is quite old so 🤷‍♂️ ).

Thanks for taking a look @amio

@dougwilson
Copy link
Author

It looks like shields.io is not even using an API for coveralls is what's happening -- it just loads https://coveralls.io/repos/github/expressjs/morgan/badge.svg?branch=master under the hood, looks at the Location response header and parses the percentage from that. I wonder why they go through that trouble 🤔 Maybe the Coveralls API has just always been broken?

@dougwilson
Copy link
Author

@amio
Copy link
Member

amio commented Aug 10, 2018

I think what they do is getting the result of coveralls.io's default badge data.

coveralls.io use redirection for performance (no need to generate badge svg on the fly), then shields.io read the Location header for faster result.

@amio
Copy link
Member

amio commented Aug 10, 2018

coveralls.io's "official" badge shows coverage | 100% while their page reporting COVERAGE DECREASED (-0.4%) TO 99.138% 😅

image

Seems the official badge might be outdated sometime, and shields.io try to be consistent with official badge.

@dougwilson
Copy link
Author

Well, 100% is correct for master branch. The lower % you are seeing is from a pull request.

Using shields.io means that a badge will show coverage of repo code but switching to badgen.net with this bug means it will show whatever the most recent pr to the repo is instead it seems.

@amio
Copy link
Member

amio commented Aug 10, 2018

Hmm, yes. If there's no api for that, I should use same method as shields.

@dougwilson
Copy link
Author

This is amazing, thank you!

@tunnckoCore
Copy link
Contributor

tunnckoCore commented Aug 10, 2018

Call it Coveralls, and don't hate it more. 🤣

@amio
Copy link
Member

amio commented Aug 11, 2018

What? Call it "coveralls" on label?

@tunnckoCore
Copy link
Contributor

No no.. :D Just trolling Coveralls, cuz always was not good.

@amio
Copy link
Member

amio commented Aug 11, 2018

😂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants