8000 GitHub - ALai57/ns-analyzer
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

ALai57/ns-analyzer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NS-Analyzer

A static namespace analyzer/visualization tool for "seeing" a Clojure project's architecture.

Useful for visualizing how your namespaces depend on one another, and grouping them into meaningful units.

Requires Graphviz/Dot for rendering (since it uses Rhizome under the hood)

Example output

Point it at the right place in your codebase, then use regular expressions to define what namespaces belong to which "cluster".

(require '[ns-analyzer.core :refer :all])

(def dep-graph
  (get-dep-graph "../andrewslai/src/andrewslai/clj"))

(def clusters
  [[#".*http-api.*"    :http-api]
   [#".*entities.*"    :core-data-structures]
   [#".*persistence.*" :persistence]
   [#".*\.api\..*"     :core-api]
   [#".*\.utils\..*"   :utilities]
   [#".*\.auth\..*"    :auth]])

(viz/view-graph (keys (:dependencies dep-graph)) (:dependencies dep-graph)
                :options             {"nodesep" "0.1"}
                :node->cluster       (partial find-cluster clusters)
                :cluster->descriptor (fn [node] {:label node, :bgcolor "#03c2fc"})
                :node->descriptor    (fn [node] {:label (-> node
                                                            (str/replace #"ns-analyzer." "")
                                                            (pretty-print-ns))})

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0