What is the most accurate CLOC (count lines of code) program?
I searched for "what is the most accurate lines of code counter linux", but didn't get relevant results. This tcount CLOC project says that it's somehow better than others ones. I don't really believe in this. So I wanted to find out which CLOC program is the most accurate.
1 answer
Objectively, the most accurate way would be to actually count the lines. So you would do wc
on each file and add them up.
This ends up being not a very useful statistic, because it is sensitive to many trivial things that people who talk about LoC would rather disregard: Blank lines, lines broken for readability, commented lines, duplicated code, dummy files, non-code files.
Usually, what people want to know is something like "how many instructions in this codebase?" because they are trying to understand its complexity, not how many times you pressed the return key. This is probably why tcount
claims it's more accurate.
There's another tool called SLOCCount which is made by a researcher who is an expert on measuring code base complexity. There are many others as well if you search for line counters online.
3 comment threads