From eab6931acff0e043baefe55acb679357bf762fb5 Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Fri, 14 Dec 2018 16:25:34 -0500 Subject: Add ULOC --- 004-uloc.7 | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Makefile | 1 + 2 files changed, 65 insertions(+) create mode 100644 004-uloc.7 diff --git a/004-uloc.7 b/004-uloc.7 new file mode 100644 index 00000000..d0968dc7 --- /dev/null +++ b/004-uloc.7 @@ -0,0 +1,64 @@ +.Dd December 14, 2018 +.Dt ULOC 7 +.Os "Causal Agency" +. +.Sh NAME +.Nm ULOC +.Nd unique lines of code +. +.Sh 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. +. +.Pp +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: +. +.Bd -literal -offset indent +sort -u *.h *.c | wc -l +.Ed +. +.Pp +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. +. +.Pp +It can also be amusing +to read all of your code sorted alphabetically. +. +.Sh AUTHORS +.An June McEnroe Aq Mt june@causal.agency +. +.Pp +This document is produced from +.Xr mdoc 7 +source available from +.Lk https://code.causal.agency/june/text.causal.agency "Code Toilet" +. +.Sh CAVEATS +Estimates such as these +should not be used for decision making +as if they were data. diff --git a/Makefile b/Makefile index 8b50a0f8..2fd9b894 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,7 @@ WEBROOT = /usr/local/www/text.causal.agency TXTS += 001-make.txt TXTS += 002-writing-mdoc.txt TXTS += 003-pleasant-c.txt +TXTS += 004-uloc.txt all: $(TXTS) -- cgit 1.4.1 4f2f7741c11c7b9c601c079450c5980d2f10c29e&showmsg=1&follow=1'>.local/bin/np (unfollow)
Commit message (Collapse)Author
2021-01-29Use int when checking for EOFJune McEnroe
2021-01-28Move gpl.c and agpl.c templates out of etcJune McEnroe
2021-01-27Set para and sect for mdocJune McEnroe
Copied from the OpenBSD defaults.
2021-01-26Use First state to match keyword at beginning of lineJune McEnroe
Otherwise keywords at the beginnings of lines with preceeding whitespace are not matched.
2021-01-25Install vi on Linux and nvi on macOSJune McEnroe
2021-01-25Use vi and lessJune McEnroe
I haven't used neovim in a couple weeks by now, so I may as well commit this.
2021-01-20Use mtags for sh in source-filterJune McEnroe
2021-01-20Generate tags for sh files in mtagsJune McEnroe
Only matches functions declared at the beginnings of lines, but I'm fine with that.
2021-01-20Add messy sh lexerJune McEnroe
Surprisingly seems to work for everything I looked at in my repos.
2021-01-20Add all target to git.causal.agency MakefileJune McEnroe
2021-01-20Remove Lua supportJune McEnroe
Lua support is unused and the dlsym fwrite/write hacks horrify me. Clean it up.
2021-01-20Fix tests for diff spansJune McEnroe
2021-01-20Avoid matching ':' in make tagsJune McEnroe
Otherwise a :: rule includes one of the ':'s in the tag name.
2021-01-19Prefer tag matches not preceded by [[:alnum:]]June McEnroe
Otherwise the "id" in "void" matches for "void id".
2021-01-19Escape \ and / in mtags search patternsJune McEnroe
2021-01-20Use mtags in source-filterJune McEnroe
2021-01-19Add mtags to generate tags for make and mdocJune McEnroe
2021-01-19Map tags to IDs using only [[:alnum:]-._]June McEnroe
2021-01-19Don't use a pager if reading standard inputJune McEnroe
2021-01-19Support BSD make syntax and match *.amJune McEnroe
These don't really go together, but...
2021-01-19Match tab following escaped newline in make assignmentsJune McEnroe
Otherwise it ends up going into Shell state.
2021-01-18Allow matching lexers using first input lineJune McEnroe