boyter / scc

Sloc, Cloc and Code: scc is a very fast accurate code counter with complexity calculations and COCOMO estimates written in pure Go
MIT License
6.28k stars 250 forks source link

sourcehut on sloc.xyz #410

Closed nektro closed 8 months ago

nektro commented 9 months ago

it would be great if the badge worked for projects hosted on https://git.sr.ht/

boyter commented 9 months ago

@nektro got some examples of how you would expect it to work and the repos it would be pulling from?

Its not hard to do actually, just I don't think I have an account.

nektro commented 9 months ago

i particularly wanted to add https://github.com/boyter/scc#badges-beta to the README of https://git.sr.ht/~nektro/magnolia-desktop

nektro commented 9 months ago

so i imagine the badge url would either be hardcoded to the main instance like https://sloc.xyz/git.sr.ht/~nektro/magnolia-desktop or generic over self hosted ones as well eg https://sloc.xyz/sourcehut/git.sr.ht/~nektro/magnolia-desktop

nektro commented 9 months ago

depending on how sloc.xyz is architected, the former could be ideal from a user's perspective as then it would be identical to the http git clone path and be able to support other self hosting options as well

boyter commented 9 months ago

Yep thats how I would do it. So long as it follows the same pattern then no problem.

What does the git repo for that example you have look like though? I need to convert

https://sloc.xyz/git.sr.ht/~nektro/magnolia-desktop

to a git repo under the hood to ensure it works.... I guess I could create an account, but if you have it handy I can probably do this now.

nektro commented 9 months ago

https://git.sr.ht/~nektro/magnolia-desktop is a valid git clone url so the idea if you take the request path to sloc which in this case would be /git.sr.ht/~nektro/magnolia-desktop, trim the leading /, and prepend https://

boyter commented 9 months ago

ah thats very easy then

boyter commented 8 months ago

So easy in fact I totally forgot about it.

https://sloc.xyz/sr.ht/~nektro/magnolia-desktop/

Works now though.

Will also work got git.sr.ht, just in case you forget to tweak it.

https://sloc.xyz/git.sr.ht/~nektro/magnolia-desktop/

I also tweaked the README.md to have examples for each provider https://github.com/boyter/scc#a-example-for-each-supported-provider just to make things easier for everyone.