Simple CLI tool to count the number of unique lines in source files.

Complete

About uloc - Unique Lines of Code


Simple CLI tool to count the number of unique lines in source files. It can be used as a sort of heuristic for how DRY your code is.

I wanted to make this after I noticed I do quite a bit of copy pasting of code, this may help to see if it's gotten out of hand (though of course it's not that smart).

Part of the challenge was to make something in C, and try to make it efficient and small, with very few dependencies.

I learned a lot about UTF in this project and how Windows sucks at it 😉

Read more
Filters

Recent Activity

I took some output from &uloc and put it into Google Sheets, and made some charts. Shown is the number of source lines compared to number of unique lines over the course of some git commit history. The overlayed line shows the rate at which no. of source lines is increasing relative to unique lines, ranging from 0x to 4x. In the first pic you can see the rate is somewhat tame compared to the second pic, where there's some spikes going up to 3x - 4x, hinting that the code added at those commits was largely duplicate code.

View original message on Discord

Added JSON output support to &uloc. The * syntax is handled by the shell though and using jq for formatting.

View original message on Discord

Today I added directory support to &uloc as well as csv/tsv output, so you can tranform or view the data with external tools. Also fixed some bugs and made a github repo :)

View original message on Discord