Permalink
Browse files

Revert "use *config* to specify users' style preferences, for example…

… `:group-imports-by-package`"

This reverts commit 63a3a61.
  • Loading branch information...
1 parent 63a3a61 commit 4b97f33c572bafa21c5a2016f12af9e2308d3b98 Alex Baranosky committed Dec 24, 2012
Showing with 10 additions and 27 deletions.
  1. +2 −6 src/slam/hound/stitch.clj
  2. +8 −21 test/slam/hound/stitch_test.clj
@@ -1,7 +1,5 @@
(ns slam.hound.stitch
- (:require [slam.hound.config :refer [*config*]]
- [slam.hound.prettify :refer [prettify]]))
-
+ (:use [slam.hound.prettify :only [prettify]]))
(def ^:private ns-map-clauses [:require-as :require-refer :import])
@@ -24,9 +22,7 @@
(defn collapse-clause [ns-map clause]
(case clause
:require-refer (update-in ns-map [:require-refer] group-by-namespace)
- :import (if (:group-imports-by-package *config*)
- (update-in ns-map [:import] group-by-package)
- ns-map)
+ :import (update-in ns-map [:import] group-by-package)
:require-as ns-map))
(defn- collapse-clauses [ns-map]
@@ -1,6 +1,5 @@
(ns slam.hound.stitch-test
- (:require [clojure.test :refer [deftest is testing]]
- [slam.hound.config :refer [*config*]]
+ (:require [clojure.test :refer [deftest is]]
[slam.hound.stitch :refer [ns-from-map stitch-up sort-subclauses collapse-clause]]))
(def sample-ns-form '(ns slamhound.sample
@@ -43,25 +42,13 @@
(sort-subclauses sample-ns-map))))
(deftest ^:unit test-collapse-import
- (testing "defaults to grouping imports by package"
- (is (= {:import '[(clojure.lang Compiler$BodyExpr)
- (java.io ByteArrayInputStream File)
- (java.util UUID)]}
- (collapse-clause {:import '(clojure.lang.Compiler$BodyExpr
- java.io.ByteArrayInputStream
- java.io.File java.util.UUID)}
- :import))))
-
- (testing "you can turn off grouping by package"
- (is (= {:import '[clojure.lang.Compiler$BodyExpr
- java.io.ByteArrayInputStream
- java.io.File
- java.util.UUID]}
- (binding [*config* (assoc *config* :group-imports-by-package false)]
- (collapse-clause {:import '(clojure.lang.Compiler$BodyExpr
- java.io.ByteArrayInputStream
- java.io.File java.util.UUID)}
- :import))))))
+ (is (= {:import '[(clojure.lang Compiler$BodyExpr)
+ (java.io ByteArrayInputStream File)
+ (java.util UUID)]}
+ (collapse-clause {:import '(clojure.lang.Compiler$BodyExpr
+ java.io.ByteArrayInputStream
+ java.io.File java.util.UUID)}
+ :import))))
(deftest ^:unit test-collapse-use
(is (= {:require-refer '[[clojure.test :refer [deftest is]]

0 comments on commit 4b97f33

Please sign in to comment.