Clojure library for organizing ns form in a way that whitespace and comments are preserved.
Rules to apply are fully customizable; the default implementation
- sorts
:require,:require-macros,:useand:use-macroslibspecs alphabetically and removes duplicates - sorts
:importclass names alphabetically and removes duplicates - sorts
:exclude,:only,:refer,:refer-macrosand:renameoptions alphabetically and removes duplicates
Also available as Leiningen plugin lein-nsorg and command line tool nsorg-cli.
Dependency information:
[nsorg "0.2.0"](require '[nsorg.core :as nsorg])
(println (nsorg/rewrite-ns-form "
(ns foo
;; use
(:use [a.c :only [y z x z]]
a
[a.b]
))
"))
(ns foo
;; use
(:use a
[a.b]
[a.c :only [x y z]]
))Check API documentation for more details.
- Throws exception on some valid ns forms
- Doesn't sort
:refer,:loador:gen-classclauses
Copyright © 2018 Immo Heikkinen
Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.