Skip to content

Instantly share code, notes, and snippets.

@seryh
Forked from joelittlejohn/find-unused-clj.sh
Created May 18, 2017 04:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seryh/90f1886a018c462b8ff2065bb0e5439e to your computer and use it in GitHub Desktop.
Save seryh/90f1886a018c462b8ff2065bb0e5439e to your computer and use it in GitHub Desktop.
Very quick and dirty command to find unused functions and vars in a Clojure project
#!/bin/bash
for f in $(egrep -o -R "defn?-? [^ ]*" * --include '*.clj' | cut -d \ -f 2 | sort | uniq); do
echo $f $(grep -R --include '*.clj' -- "$f" * | wc -l);
done | grep " 1$"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment