DEV Community

Discussion on: How to count lines of code you written.

moopet profile image
Ben Sinclair

You shouldn't need to run anything with sudo for this kind of purpose.

I'd like to point out that "source lines of code" is a very dodgy metric to use for anything. It depends entirely on things like the language you use and the formatting you use and the sloc algorithm your software is using to measure things. Not only that, but the number of lines you've written rarely has anything to do with how much work you've done, how much progress a project has made or how many features have been completed.

It's probably useful if you want a summary of how much has changed since a previous date, but you can get that using a diff in your VCS. For instance, git diff --name-only old-version-tag is likely to give you something that's of more practical use than knowing your code includes 143 block comments.