In a GitHub repository you can see “language statistics”, which displays the percentage of the project that’s written in a language. It doesn’t, however, display how many lines of code the project consists of. Often, I want to quickly get an impression of the scale and complexity of a project, and the count of lines of code can give a good first impression. 500 lines of code implies a relatively simple project, 100,000 lines of code implies a very large/complicated project.
So, is it possible to get the lines of code written in the various languages from a GitHub repository, preferably without cloning it?
The question “Count number of lines in a git repository” asks how to count the lines of code in a local Git repository, but:
- You have to clone the project, which could be massive. Cloning a project like Wine, for example, takes ages.
- You would count lines in files that wouldn’t necessarily be code, like i13n files.
- If you count just (for example) Ruby files, you’d potentially miss massive amount of code in other languages, like JavaScript. You’d have to know beforehand which languages the project uses. You’d also have to repeat the count for every language the project uses.
All in all, this is potentially far too time-intensive for “quickly checking the scale of a project”.
git clone --depth 1
. As for 2 and 3, I suspect there is software out there which can do the analysis for you, and you can do a lot of guessing based on file extensions, but I'm having a hell of a time coming up with a good search term to find said software. Maybe you need to ask another question. – Jaquelin(Get-ChildItem -Recurse -File | Get-Content | Measure-Object -Line).Lines
– Convolvulus