Last active
January 6, 2019 15:35
-
-
Save hasantayyar/4e7aaa1a23d86569407ce2d3dc7461d1 to your computer and use it in GitHub Desktop.
Revisions
-
hasantayyar revised this gist
Jan 6, 2019 . 1 changed file with 5 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,5 @@ # list code lines find . -type f -name "*.ts" -exec cat {} + | sort -u # count them find . -type f -name "*.ts" -exec cat {} + | sort -u | wc -l -
hasantayyar created this gist
Jan 6, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,39 @@ ULOC(7) FreeBSD Miscellaneous Information Manual ULOC(7) NAME ULOC – unique lines of code DESCRIPTION There are many tools available which measure SLOC: source lines of code. These tools are strangely complex for what they intend to do, which is to estimate the relative sizes of projects. They perform some amount of parsing in order to discount comments in various languages, and for reasons unknown each format their ouput in some oddly encumbered way. I propose a much simpler method of estimating relative sizes of projects: unique lines of code. ULOC can be calculated with standard tools as follows: sort -u *.h *.c | wc -l In my opinion, the number this produces should be a better estimate of the complexity of a project. Compared to SLOC, not only are blank lines discounted, but so are close-brace lines and other repetitive code such as common includes. On the other hand, ULOC counts comments, which require just as much maintenance as the code around them does, while avoiding inflating the result with license headers which appear in every file, for example. It can also be amusing to read all of your code sorted alphabetically. AUTHORS C. McEnroe <[email protected]> This document is produced from mdoc(7) source available from Code Toilet: https://code.causal.agency/june/text.causal.agency CAVEATS Estimates such as these should not be used for decision making as if they were data. Causal Agency December 14, 2018 Causal Agency