ยท projects

Von Count

We recently found need to count lines of our code, but with added context that things like `cloc` can't give us. Basically at a glance we wanted to see the use of certain features/components/libraries so that we could phase them out slowly over time and see progress ๐Ÿงฎ.

I vant to count your lines!

To that end we produced VonCount

VonCount produces tables of results for folders of source code, those results are determined by an optional configuration. The configuration can decide any number of groups which are named and are specified by patterns that match the start and end of a particular block of something. For example documentation where you want to count lines between /** and */:

{
  "groups": [
    {
      "name": "documentation",
      "between": {
        "start": "^\\/\\*\\*",
        "end": "^ \\*/$"
      }
    }
  ]
}

These will then be matched and counted alongside the rest of the source, producing a table that shows total lines, number of lines in your groups and the representation as a % of those groups.

npm install -g voncount
voncount run .
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Path           โ”‚ Lines โ”‚ 'documentation' โ”‚     % โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ test           โ”‚   232 โ”‚              19 โ”‚  8.19 โ”‚
โ”‚   components   โ”‚   207 โ”‚              19 โ”‚  9.18 โ”‚
โ”‚     Header.js  โ”‚    18 โ”‚               4 โ”‚ 22.22 โ”‚
โ”‚     Content.js โ”‚   179 โ”‚              15 โ”‚  8.38 โ”‚
โ”‚     Footer.js  โ”‚    10 โ”‚               0 โ”‚     0 โ”‚
โ”‚   pages        โ”‚    25 โ”‚               0 โ”‚     0 โ”‚
โ”‚     index.js   โ”‚    25 โ”‚               0 โ”‚     0 โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

And you get a neat breakdown of it all ๐Ÿš€!

We are still pretty early with our build on this, but feel itโ€™s useful so will be investing more and more time into it. Itโ€™s great for developer led metrics, and removing/adding certain facets to your code base give it a try.

Share: