6

There are similar questions but all of them need you to clone repository and then run some utility on it. I need a web-service which can give me those stats (something like using an URL e.g. http://my-sloc-counter.com/project1 to get SLOC stats for project1 from GitHub)

Mahdi
  • 1,871
  • 2
  • 24
  • 41

2 Answers2

5

For GitHub specifically, you have a possibility to compute an approximation of that data (LOC: Lines of Code) through the GitHub Statistics API.

You can see an example in "Can you get the number of lines of code from a GitHub repository?", which does not involve cloning the repo.


More recently, you have the project jolav/codetabs (initally mentioned by Sclerosis), based on Curtis Gagliardi cgag/loc for counting lines of code.
It includes a service for counting lines for any public GitHub repository:
codetabs.com/count-loc/count-loc-online.html.

Example for my project: https://api.codetabs.com/v1/loc?github=vonc/seec


Problem (for both solutions): they do count the lines of all files inside a repo, so if you have vendored files like in a Go project, you will have a hard time distinguishing what you wrote from what you have vendored.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I was hoping for a solution which doesn't need much coding. – Mahdi Mar 11 '16 at 07:27
  • @mahdix I understand, but there is no direct way to get that information from a GitHub repo at this time. Cloning the repo (shallow clone if needed) remains the most precise and practical way to get that data. – VonC Mar 11 '16 at 07:31
1

There is browser extension for Google Chrome named Gloc.

Kas Elvirov
  • 7,394
  • 4
  • 40
  • 62