Shields: Code Climate badge username is case sensitive

Created on 6 Aug 2019  路  2Comments  路  Source: badges/shields

Are you experiencing an issue with...

  • [x] [shields.io](https://shields.io/#/)
  • [ ] My own instance
  • [ ] [gh-badges NPM package](https://www.npmjs.com/package/gh-badges)

:beetle: Description

:link: Link to the badge

Originally I thought one Code Climate badge through Shields is not working. It turns out it is case sensitive.

Badge from Shields

1) Username: Hongbo-Miao
![Code Climate maintainability](https://img.shields.io/codeclimate/maintainability/Hongbo-Miao/hongbomiao.com)

image

2) Username: hongbo-miao
![Code Climate maintainability](https://img.shields.io/codeclimate/maintainability/hongbo-miao/hongbomiao.com)

image

:bulb: Possible Solution

If the username is not case sensitive, that will be better user experience!

BTW, thanks for the cool library!

question

Most helpful comment

That's because with the native CodeClimate badge, you are using the repo ID directly. The Shields experience allows users to specify their user and repo names, which we are internally using to call a CC api to determine the repo id. That CC Repositories API is apparently case sensitive on the GitHub slug, which is not something we can control.

To see why this is happening, compare the results of:
https://api.codeclimate.com/v1/repos?github_slug=Hongbo-Miao/hongbomiao.com
with:
https://api.codeclimate.com/v1/repos?github_slug=hongbo-miao/hongbomiao.com

Within Shields, we have no way of knowing what the "correct" case should be for any given GitHub owner/repo value so I don't see anything we could do within Shields to allow our users to specify any case.

If this is something you'd really like to see, then you'll probably need to reach out to the CodeClimate team to see if they can make their Repositories API case insensitive on the GitHub Slug query parameter.

All 2 comments

That's because with the native CodeClimate badge, you are using the repo ID directly. The Shields experience allows users to specify their user and repo names, which we are internally using to call a CC api to determine the repo id. That CC Repositories API is apparently case sensitive on the GitHub slug, which is not something we can control.

To see why this is happening, compare the results of:
https://api.codeclimate.com/v1/repos?github_slug=Hongbo-Miao/hongbomiao.com
with:
https://api.codeclimate.com/v1/repos?github_slug=hongbo-miao/hongbomiao.com

Within Shields, we have no way of knowing what the "correct" case should be for any given GitHub owner/repo value so I don't see anything we could do within Shields to allow our users to specify any case.

If this is something you'd really like to see, then you'll probably need to reach out to the CodeClimate team to see if they can make their Repositories API case insensitive on the GitHub Slug query parameter.

@calebcartwright Thanks, I think you are right! I guess it will be their API experience issue.

Was this page helpful?
0 / 5 - 0 ratings