Hacker News new | ask | show | jobs
by christophilus 3310 days ago
TL;DR; He wrote a tool that accurately counts the number of lines in a Clojure project (e.g. ignores comments, etc) and also counts the number of nodes in said project's AST.

I think an interesting metric would be number of AST nodes per line, maybe even providing the top N most complex lines, where complexity is number of nodes per line.

I find that some languages (Scala and Perl come to mind) tend to encourage extremely dense one-liners that have way too much going on with many tiny little temporary variables and symbols all crammed into a short amount of space.

A tool like this, if added to a linter could help discourage that sort of programming.

1 comments

It would be humorous, but instructive, to have something like this for Java that parses it and dumps out metrics about the tree size for a project - AST node count and static depth, where possible to tell.