Created
March 9, 2021 13:42
-
-
Save opqdonut/f5078e62aac2325d9c8fd989d46feb91 to your computer and use it in GitHub Desktop.
Finding the longest functions in a clojure codebase
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# via awk, assuming everything with a ( in column 0 is a definition: | |
awk '/^\(/ {print c, f, s; f=FILENAME; s=$0; c=0} {c++} END {print c, FILENAME, s}' **/*.clj **/*.cljs **/*.cljc | sort -rn | head | |
# or, more accurately via the clj-kondo linter | |
clj-kondo --config '{:output {:analysis true :format :json}}' --lint src --lint test | jq -r '.analysis ["var-definitions"] | .[] | ((.["end-row"] - .row) | tostring) + " " + .ns + "/" + .name ' | sort -rn | head |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment