Giter Site home page Giter Site logo

Github readme badges about goreportcard HOT 22 CLOSED

gojp avatar gojp commented on June 1, 2024
Github readme badges

from goreportcard.

Comments (22)

fubarhouse avatar fubarhouse commented on June 1, 2024 4

Is there any intention right now to add the "for-the-badge" style - because it clearly isn't supported...

from goreportcard.

hermanschaaf avatar hermanschaaf commented on June 1, 2024 1

Yeah, Github does some pretty aggressive caching of the images, unfortunately. If you look at the image source on the readme, you'll see that it actually links to camo.githubusercontent.com, not goreportcard.com. We set a cache-control header (https://github.com/gojp/goreportcard/blob/master/handlers/badge.go#L68) to tell Github not to cache the image, but looks like they (or, potentially, a proxy in between you and them) are not respecting it.

from goreportcard.

chmike avatar chmike commented on June 1, 2024 1

I could see the A+ after two hours delay. Good to know if some raise up the problem again. Some cache in the path needed to be refreshed. The cache save your servers from many requests and reduce display latency. So its OK. Thank you for the fast response and for keeping the service running.

from goreportcard.

hermanschaaf avatar hermanschaaf commented on June 1, 2024

It works!

screenshot from 2015-02-08 11 24 56

... but Github is aggressively caching the image on their CDN. We need to send the Cache-Control: no-cache header to avoid that, and I'm not sure if we can do it with the current hacky way I'm redirecting to the image location on shields.io. Will need to fix this before adding links to the badge on the site 🐈

from goreportcard.

gdamore avatar gdamore commented on June 1, 2024

Yes please! Maybe what should happen is that shields.io should present an ETag. If that were done, then you wouldn't have to disable caching. Put another way, I think this needs to be solved by shields.io, not goreportcard.

from goreportcard.

shawnps avatar shawnps commented on June 1, 2024

This might already be happening, so maybe everything is fine..? badges/shields#221 will have to test it a bit

from goreportcard.

client9 avatar client9 commented on June 1, 2024

It seems to work

from goreportcard.

client9 avatar client9 commented on June 1, 2024

But it is not advertised nor clear how to do it. I just copied what I found in
https://raw.githubusercontent.com/gojp/goreportcard/master/README.md

from goreportcard.

shawnps avatar shawnps commented on June 1, 2024

well, i'm showing it on the page, but that requires people to copy the img address and do some manual work to get it into their readme... should be able to make it nicer i'm just bad at JS

from goreportcard.

shawnps avatar shawnps commented on June 1, 2024

seems that you also need to hard-refresh to get the newest badge if the repo's grade changes

from goreportcard.

hermanschaaf avatar hermanschaaf commented on June 1, 2024

Yes, the reason we didn't advertise it is that you need to hard-refresh for it to update, because it's getting cached. Right now, if memory serves, we are returning a redirect to the image hosted on shields.io, and that is what gets cached. If we want to fix this properly, I think we might need to work with shields.io, or add a no-cache header to the images we serve ourselves.

from goreportcard.

hermanschaaf avatar hermanschaaf commented on June 1, 2024

Actually, is a hard-refresh always enough? I thought it was github's CDN caching the image, not the browser

from goreportcard.

shawnps avatar shawnps commented on June 1, 2024

@hermanschaaf ah sorry to be more specific, I meant I had to hard refresh the Go Report Card page that I'm displaying the badge on, not the README that someone might put it in

from goreportcard.

hermanschaaf avatar hermanschaaf commented on June 1, 2024

I'm going to close this issue for now. The badges do seem to update if you force refresh once or twice. So... until someone complains, let's close this one and focus on other things.

from goreportcard.

miniwark avatar miniwark commented on June 1, 2024

As the badges use shields.io, if possible, if would be nice to allow the use of shield.io ?style parameters (and maybe other too like ?label and ?maxAge). I miss the possibility to flat square this only badge on my project.

from goreportcard.

hermanschaaf avatar hermanschaaf commented on June 1, 2024

@miniwark We just added a feature that allows you to style the badge (thanks @tomohiro!)

You can do it simply by adding ?style=[style name] to the existing URL in your readme. The options for style names are the same as on shields.io, i.e.:

  • ?style=plastic
  • ?style=flat
  • ?style=flat-square
  • ?style=social

from goreportcard.

miniwark avatar miniwark commented on June 1, 2024

@hermanschaaf Thanks! I confirm than this is working.

from goreportcard.

chmike avatar chmike commented on June 1, 2024

The badge is unfortunately not updated on github. It works well with travis and goverall badges.
github displays a B, while I now have an A+. This is frustrating.

Thank you for the package and service. It's a great service to enhance code quality. I wish I could see my numeric score.

from goreportcard.

shawnps avatar shawnps commented on June 1, 2024

@chmike would you mind posting a specific repo so we can take a look? Thanks

from goreportcard.

hermanschaaf avatar hermanschaaf commented on June 1, 2024

Hi @chmike, thanks for the feedback! This is probably due to image caching on the part of either Github, or your browser. A browser hard refresh might fix it. You didn't specify which repository you are talking about, but if it's securecookie, it shows as an A+ to me:

screenshot 2017-09-23 18 05 47

from goreportcard.

chmike avatar chmike commented on June 1, 2024

Yes! That is the repository. Thank you very much. How come that I only see a B ? I tried connecting from another computer (same network) so the browser cache can't be in play. I also tried a hard refresh with shift reload and ctrl-F5 (windows). I tested with my phone, (fresh connection & different provider) and I also see the B label. It looks like a github issue.

from goreportcard.

hewiefreeman avatar hewiefreeman commented on June 1, 2024

This might be an old topic, but I'm having the same issue: Github's caching is preventing my badge from updating even with a hard refresh.

Since you're already using query strings for styling the image and headers just don't get the job done, you could add another query string to the Image URL and Markdown templates (on the report cards). It's effective enough to just get the ID of the latest commit and make the dynamic URLs like:

https://goreportcard.com/report/github.com/username/ProjectName?v=lastCommitID

Or with a style:

https://goreportcard.com/report/github.com/username/ProjectName?v=00ec17d&style=plastic

Shouldn't this be a built-in feature since the badges are used in and viewed from Github a lot?

from goreportcard.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.