phpinsights icon indicating copy to clipboard operation
phpinsights copied to clipboard

[IDEA] Badges like Shields.io

Open robsontenorio opened this issue 6 years ago • 7 comments

Q A
Bug report? no
Feature request? yes

How about phpinsights to provide natively nice badges like shields.io ? Something like to expose some dedicated route with that rendered images.

robsontenorio avatar Nov 22 '19 14:11 robsontenorio

That would be badass.

nunomaduro avatar Nov 22 '19 18:11 nunomaduro

Do you have any idea on how we could do that?

We might be able to pull it off if a user runs it in a Github action. We can at least make a formatter which formats to badges, so implementing the showing of the badges are easier.

olivernybroe avatar Nov 22 '19 18:11 olivernybroe

We could also use directly shields.io to generate badge : https://img.shields.io/badge/PHPInsights%20%7C%20Code%20-95.7%25-success.svg

https://img.shields.io/badge/PHPInsights%20%7C%20Style%20-61%25-yellow.svg

https://img.shields.io/badge/PHPInsights%20%7C%20Complexity%20-22%25-red.svg

And with that, we can add custom style :

https://img.shields.io/badge/PHPInsights%20%7C%20Architecture%20-78.1%25-success.svg?style=for-the-badge

But the main problem is to store it and keep them up to date. @olivernybroe do you think it's possible to store them as artifact in github action, and retrieve them directly by a link ?

Jibbarth avatar Nov 28 '19 20:11 Jibbarth

@Jibbarth Haven't used artifacts before with github actions, but thought that it might be possible with artifacts. It depends kinda on how artifact url's are generated :)

olivernybroe avatar Nov 29 '19 08:11 olivernybroe

So the artifacts have a random id and currently there is no API for artifacts. There are issues open for it and let's hope they add it in soon. A solution could be to use a image hosting API which have support for replacing an image, so the URL for the image doesn't change. We need it to not change, so the readme doesn't have to be updated with a new url.

olivernybroe avatar Nov 29 '19 16:11 olivernybroe

Hi, I wanted this feature so much that I created it for me you 😄 This is the github action: https://github.com/Lukasss93/phpinsights-badger-action (It will uploads phpinsights data to your self hosting service) This is the first library with the badges: https://github.com/Lukasss93/laravel-larex

If you think this is spam, please delete this message (I'm sorry 😓)

Lukasss93 avatar Sep 02 '20 23:09 Lukasss93

Not spam at all :) nice work, hope it will be usable for others here.

olivernybroe avatar Sep 03 '20 14:09 olivernybroe