Makes a graph of dependencies between functions
Clojure
Switch branches/tags
Nothing to show
Latest commit 2762fa2 Mar 24, 2015 @Hendekagon cleanup
Permalink
Failed to load latest commit information.
src cleanup Mar 24, 2015
.gitignore cleanup Mar 24, 2015
README.md updated readme Feb 28, 2014
project.clj cleanup Mar 24, 2015

README.md

lein-clique

A Leiningen plugin for generating function dependency graphs.

Usage

Put [lein-clique "0.1.2"] into the :plugins vector of your profile

lein-clique goes through your source code to find which functions external to a function's namespace it depends on, then generates a graphviz graph of those dependencies. If you analyze the graph, you can find for example which functions are most used by other functions (in-degree - in the Clojure core namespace these are: concat, seq and list), or which functions are most dependent on other functions.

Example:

cd into your project and:

$ lein clique

by default, namespaces starting with 'clojure' are excluded so if you want to include clojure's namespaces do:

$ lein clique []

or to filter out namespaces beginning with certain strings:

$ lein clique [\"somenamespace\" \"anothernamespace\"]

A graphviz file called deps.dot is then generated, which you can run through a graph visualization tool like Gephi to make it look nice.

Using Clique without leiningen:

You can also just use Clique as a library by adding [lein-clique "0.1.2"] to your project.clj's :dependencies vector, then:

=> (require '[clique.core :as c])
=> (c/all-deps "./src")

will return a map of all functions in namespaces in your source path to the functions they depend on (including duplicates, in case you want to know frequencies)

=> (pprint (sort-by val (frequencies (mapcat val (c/all-deps "./src")))))

to get such a map for a particular namespace do:

=> (c/all-fq (c/dependencies 'your.namespace))

License

Copyright © 2013 Matthew Chadwick

Distributed under the Eclipse Public License, the same as Clojure.