Counting lines of code should be quick and easy and it is with the cloc command.

But how can cloc be used with Wolfram Language?

There are a few things to setup.

First, create a definition file with this content:

Wolfram
    filter remove_OCaml_comments
    filter remove_matches ^\s*%
    extension wl
    extension m
    3rd_gen_scale 1.00
    end_of_line_continuation \\$

Then, call cloc like this:

cloc --force-lang-def=wolfram_definition.txt --include-ext=wl,m ./my_wolfram_code_dir

You need to have --include-ext=wl,m because there are bugs in cloc:

Can't use an undefined value as an ARRAY reference at /usr/local/Cellar/cloc/1.88/libexec/bin/cloc line 2168, <$fh> line 33.

Why have filter remove_OCaml_comments in the definition?

WL comments can be nested and that causes problems for cloc.

Coincidentally, OCaml comments have the same properties and the same syntax and the author of cloc has added special support for OCaml comments, so Wolfram Language can just use that.

Updated: