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

Code Climate's 100% coverage shows red #1329

Closed
jimmerioles opened this issue Dec 5, 2017 · 7 comments
Closed

Code Climate's 100% coverage shows red #1329

jimmerioles opened this issue Dec 5, 2017 · 7 comments
Labels
bug Bugs in badges and the frontend service-badge Accepted and actionable changes, features, and bugs

Comments

@jimmerioles
Copy link

jimmerioles commented Dec 5, 2017

I noticed Code Climate's coverage shows red even if i got 100% coverage, is this expected behavior? shouldn't it be green?

image

@PyvesB
Copy link
Member

PyvesB commented Dec 5, 2017

Thanks for your report, I'll look into it. 😉

@paulmelnikow paulmelnikow added the question Support questions, usage questions, unconfirmed bugs, discussions, ideas label Dec 5, 2017
@PyvesB
Copy link
Member

PyvesB commented Dec 5, 2017

The code in shields basically constructs the code coverage badge shown in your screenshot by retrieving the headers from Code Climate's own badges, in your case this one.

The information displayed by Code Climate seems to have changed recently, switching from showing a score (A for instance) to a percentage (100% for instance). Your badge would have previously shown as this: CodeClimate

Good news is that the service tests picked this up, and one test is now failing.

I am unsure how to approach this problem. As far as I can tell, most of their APIs seem to require authentication (see the documentation). We do seem to be able to publicly access https://api.codeclimate.com/v1/repos?github_slug=XXX. shields retrieves the badge_token from that endpoint, and uses it to fire off a second request to retrieve Code Climate's badges headers. Unless I have missed something, I don't think we would be able to use the proper test reports endpoint to directly get the code coverage score without providing an authentication token. Now that the code coverage score is no longer retrievable, the only simple way to get our badge to display a score rather than a percentage might be to reproduce the percentage -> score mapping on our side. This is not ideal.

By the way, other Code Climate badges seem to be broken on shield's homepage.

As a side note, they have warned us that their API is likely to change:

The Code Climate API is currently in Beta. Some endpoints and responses may change without warning.

@paulmelnikow
Copy link
Member

Does the work in #1236 shed any light on this?

@PyvesB
Copy link
Member

PyvesB commented Dec 5, 2017

Well the initial pull request comment is in line with my analysis above regarding the first API request and subsequent badge information retrieval, so at least we all agree on what the code was previously supposed to do. ^^

Unfortunately one of the two badges added by that pull request are no longer working as expected as a consequence of a recent Code Climate change and we have to come up with a different approach to retrieve the now missing information.

@paulmelnikow paulmelnikow added bug Bugs in badges and the frontend service-badge Accepted and actionable changes, features, and bugs and removed question Support questions, usage questions, unconfirmed bugs, discussions, ideas labels Dec 8, 2017
@paulmelnikow
Copy link
Member

#1368 has been merged. Should this be closed?

@RedSparr0w
Copy link
Member

RedSparr0w commented Dec 22, 2017

It partially closes this,
/c/user/repo.svg will now show your score as A-F (as returned by codeclimate API)
/coverage/user/repo.svg is still broken and shows
But (i think) expected output is for /coverage

Not sure if /coverage is going to end up with the same output as /c or a percentage.

@PyvesB
Copy link
Member

PyvesB commented Jan 31, 2018

I believe this issue can be closed, as #1387 is now merged. 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bugs in badges and the frontend service-badge Accepted and actionable changes, features, and bugs
Projects
None yet
Development

No branches or pull requests

4 participants