Comments (22)
Is there any intention right now to add the "for-the-badge" style - because it clearly isn't supported...
from goreportcard.
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.
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.
It works!
... 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.
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.
This might already be happening, so maybe everything is fine..? badges/shields#221 will have to test it a bit
from goreportcard.
It seems to work
from goreportcard.
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.
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.
seems that you also need to hard-refresh to get the newest badge if the repo's grade changes
from goreportcard.
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.
Actually, is a hard-refresh always enough? I thought it was github's CDN caching the image, not the browser
from goreportcard.
@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.
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.
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.
@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.
@hermanschaaf Thanks! I confirm than this is working.
from goreportcard.
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.
@chmike would you mind posting a specific repo so we can take a look? Thanks
from goreportcard.
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:
from goreportcard.
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.
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)
- ineffassign check not reproducible locally
- Report is generated for different tag and unable to change default branch
- More customization for shields.io
- cli alters generated files HOT 2
- reportcard can't parse my code HOT 2
- show me my repo ... HOT 4
- Go Report Card could not analyze my repo
- Test files should not be analyzed
- Refresh feature not working HOT 2
- [Help]My badge is not updated HOT 1
- "v2" support
- Specifying a directory with the CLI option -d does not work HOT 1
- gofmt issue with header comment not reproducable locally HOT 1
- gofmt -s ineffective
- Could not analyze repository HOT 1
- Refresh not working HOT 3
- There was an error processing your request: Could not analyze the repository: no .go files found HOT 1
- 3 Inconsistent Behaviours (one works; the other two fail) HOT 2
- under-reported `gocyclo`?
- Allow removal of repositories that were removed/made private HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from goreportcard.