-2

I'm using GitHub api to crawl Project info (Http,JSON).
I want to crawl total lines of codes of a certain project (using java). And lines of codes of different releases.
I found there are only additions and deletions in JSON reply.

Is it the only way to download whole source code and then analyze it to get total lines of codes?
Does GitHub provide something more convenient?

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
Peter Guan
  • 308
  • 3
  • 16

1 Answers1

1

You can use the GitHub API to count the number of LOC contributed by a user.

But for the all project itself (the Git repo), you would need to clone it first and analyze it locally.
See this question:

wc -l $(git ls-files)
# or
git diff --stat 4b825dc642cb6eb9a060e54bf8d69288fbee4904

(with 4b825dc642cb6eb9a060e54bf8d69288fbee4904 being the result git hash-object -t tree /dev/null: see "git's semi-secret empty tree")

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250