Skip to content

Commit

Permalink
Remove unnecessary requires
Browse files Browse the repository at this point in the history
Added some comments about some edge cases.

Unnecessary requires aren't a major issue, but there are advantages to
cleaning them up. This PR silences some warnings from clj-kondo, makes
the namespaces easier to understand, and may avoid some circular imports
in the future.
  • Loading branch information
alysbrooks committed Mar 9, 2023
1 parent 9242fd9 commit 264e1e8
Show file tree
Hide file tree
Showing 15 changed files with 11 additions and 32 deletions.
2 changes: 1 addition & 1 deletion src/kaocha/api.clj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
[kaocha.history :as history]
[kaocha.output :as output]
[kaocha.plugin :as plugin]
[kaocha.report :as report]
[kaocha.report :as report] ;; required for resolve?
[kaocha.result :as result]
[kaocha.util :as util]
[kaocha.stacktrace :as stacktrace]
Expand Down
2 changes: 1 addition & 1 deletion src/kaocha/assertions.clj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[kaocha.report :as report]
[lambdaisland.deep-diff2.puget.color :as color]
[clojure.string :as str]
[slingshot.slingshot :refer [try+ throw+]]))
#_[slingshot.slingshot :refer [try+ throw+]]))

(defmethod t/assert-expr 'substring? [msg form]
(let [[_ s1 s2] form]
Expand Down
3 changes: 1 addition & 2 deletions src/kaocha/load.clj
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
(:require [kaocha.core-ext :refer :all]
[kaocha.testable :as testable]
[clojure.java.io :as io]
[lambdaisland.tools.namespace.find :as ctn-find]
[kaocha.output :as output]))
[lambdaisland.tools.namespace.find :as ctn-find]))

(set! *warn-on-reflection* true)

Expand Down
1 change: 0 additions & 1 deletion src/kaocha/matcher_combinators.clj
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
(ns kaocha.matcher-combinators
(:require [kaocha.report :as report]
[kaocha.output :as output]
[kaocha.hierarchy :as hierarchy]
[clojure.test :as t]
[lambdaisland.deep-diff2 :as ddiff]
[lambdaisland.deep-diff2.printer-impl :as printer]
Expand Down
1 change: 0 additions & 1 deletion src/kaocha/monkey_patch.clj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
(:require [clojure.string :as str]
[clojure.test :as t]
[kaocha.core-ext :refer :all]
[kaocha.hierarchy :as hierarchy]
[kaocha.plugin :as plugin]
[kaocha.report :as report]
[kaocha.testable :as testable]))
Expand Down
7 changes: 1 addition & 6 deletions src/kaocha/ns.clj
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
(ns kaocha.ns
(:refer-clojure :exclude [symbol])
(:require [clojure.spec.alpha :as spec]
[clojure.string :as str]
[clojure.test :as t]
[kaocha.core-ext :refer :all]
[kaocha.result :as result]
[kaocha.testable :as testable]
[kaocha.type :as type]))
[kaocha.core-ext :refer :all]))

(defn required-ns [ns-name]
(when-not (and (find-ns ns-name)
Expand Down
7 changes: 3 additions & 4 deletions src/kaocha/plugin/capture_output.cljc
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
(ns kaocha.plugin.capture-output
(:require
(:require
[clojure.java.io :as io]
[kaocha.hierarchy :as hierarchy]
[kaocha.plugin :as plugin :refer [defplugin]]
[kaocha.testable :as testable])
[kaocha.plugin :as plugin :refer [defplugin]])
(:import (java.io ByteArrayOutputStream
FileOutputStream
FileOutputStream ;; false positive
OutputStream
PrintStream
PrintWriter)))
Expand Down
4 changes: 1 addition & 3 deletions src/kaocha/plugin/filter.clj
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
(ns kaocha.plugin.filter
(:refer-clojure :exclude [symbol])
(:require [kaocha.plugin :as plugin :refer [defplugin]]
[kaocha.testable :as testable]
[clojure.set :as set]
[kaocha.output :as output]
[kaocha.core-ext :refer [symbol]]))
[kaocha.output :as output]))

(defn- accumulate [m k v]
(update m k (fnil conj []) v))
Expand Down
3 changes: 1 addition & 2 deletions src/kaocha/repl.clj
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ These will particularly come in handy when developing plugins."}
[kaocha.api :as api]
[kaocha.result :as result]
[kaocha.output :as output]
[clojure.java.io :as io]
[slingshot.slingshot :refer [throw+ try+]]))
[slingshot.slingshot :refer [try+]]))

(defn config
"Load the Kaocha configuration
Expand Down
2 changes: 1 addition & 1 deletion src/kaocha/runner.clj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
[kaocha.output :as output]
[kaocha.plugin :as plugin]
[kaocha.result :as result]
[kaocha.specs :as specs]
#_[kaocha.specs :as specs] ;; required for some reason?
[slingshot.slingshot :refer [throw+ try+]])
(:import (java.io File)))

Expand Down
1 change: 0 additions & 1 deletion src/kaocha/testable.clj
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
(ns kaocha.testable
(:refer-clojure :exclude [load])
(:require [clojure.java.io :as io]
[clojure.pprint :as pprint]
[clojure.spec.alpha :as spec]
[clojure.test :as t]
[kaocha.classpath :as classpath]
Expand Down
4 changes: 1 addition & 3 deletions src/kaocha/type/clojure/test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
[kaocha.hierarchy :as hierarchy]
[kaocha.load :as load]
[kaocha.specs]
[kaocha.test-suite :as test-suite]
[clojure.java.io :as io]
[clojure.test :as t]))
[kaocha.test-suite :as test-suite]))

(defmethod testable/-load :kaocha.type/clojure.test [testable]
(-> testable
Expand Down
1 change: 0 additions & 1 deletion src/kaocha/type/ns.clj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
(:require [clojure.spec.alpha :as spec]
[clojure.test :as t]
[kaocha.core-ext :refer :all]
[kaocha.hierarchy :as hierarchy]
[kaocha.ns :as ns]
[kaocha.testable :as testable]
[kaocha.type :as type]))
Expand Down
1 change: 0 additions & 1 deletion src/kaocha/type/spec/test/check.clj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
[kaocha.specs]
[kaocha.test-suite :as test-suite]
[kaocha.testable :as testable]
[kaocha.type :as type]
[kaocha.type.spec.test.fdef :as type.fdef]
[kaocha.type.spec.test.ns :as type.spec.ns]))

Expand Down
4 changes: 0 additions & 4 deletions src/kaocha/watch.clj
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,18 @@
[clojure.spec.alpha :as spec]
[clojure.stacktrace :as st]
[clojure.string :as str]
[clojure.test :as t]
[hawk.core :as hawk]
[kaocha.api :as api]
[kaocha.config :as config]
[kaocha.core-ext :refer :all]
[kaocha.load :as load]
[kaocha.output :as output]
[kaocha.plugin :refer [defplugin]]
[kaocha.plugin :as plugin]
[kaocha.result :as result]
[kaocha.stacktrace :as stacktrace]
[kaocha.testable :as testable]
[kaocha.util :as util]
[lambdaisland.tools.namespace.dir :as ctn-dir]
[lambdaisland.tools.namespace.file :as ctn-file]
[lambdaisland.tools.namespace.parse :as ctn-parse]
[lambdaisland.tools.namespace.reload :as ctn-reload]
[lambdaisland.tools.namespace.track :as ctn-track]
[slingshot.slingshot :refer [try+]]
Expand Down

0 comments on commit 264e1e8

Please sign in to comment.