Skip to content

Commit d3760be

Browse files
vemvbbatsov
authored andcommitted
Rename slam.hound namespaces
1 parent 5b5eb13 commit d3760be

File tree

6 files changed

+22
-20
lines changed

6 files changed

+22
-20
lines changed

project.clj

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,7 @@
6767
merge-meta [[:inner 0]]
6868
try-if-let [[:block 1]]}}}]
6969
:eastwood {:plugins [[jonase/eastwood "0.9.9"]]
70-
:eastwood {;; vendored - shouldn't be tweaked for satisfying linters:
71-
:exclude-namespaces [refactor-nrepl.ns.slam.hound.regrow]
72-
;; :implicit-dependencies would fail spuriously when the CI matrix runs for Clojure < 1.10,
70+
:eastwood {;; :implicit-dependencies would fail spuriously when the CI matrix runs for Clojure < 1.10,
7371
;; because :implicit-dependencies can only work for a certain corner case starting from 1.10.
7472
:exclude-linters [:implicit-dependencies]
7573
:add-linters [:performance :boxed-math]

src/refactor_nrepl/ns/slam/hound/search.clj renamed to src/refactor_nrepl/ns/class_search.clj

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
;;;; Copied from slamhound 1.5.5
22
;;;; Copyright © 2011-2012 Phil Hagelberg and contributors
33
;;;; Distributed under the Eclipse Public License, the same as Clojure.
4-
(ns refactor-nrepl.ns.slam.hound.search
5-
"Search the classpath for vars and classes."
4+
(ns refactor-nrepl.ns.class-search
5+
"Search the classpath for classes.
6+
7+
Formerly known as `refactor-nrepl.ns.slam.hound.search`."
68
(:require
79
[clojure.java.io :refer [file]]
810
[clojure.string :as string]

src/refactor_nrepl/ns/slam/hound/regrow.clj renamed to src/refactor_nrepl/ns/imports_and_refers_analysis.clj

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
;;;; Copied from slamhound 1.5.5
22
;;;; Copyright © 2011-2012 Phil Hagelberg and contributors
33
;;;; Distributed under the Eclipse Public License, the same as Clojure.
4-
(ns refactor-nrepl.ns.slam.hound.regrow
4+
(ns refactor-nrepl.ns.imports-and-refers-analysis
5+
"Formerly known as `refactor-nrepl.ns.slam.hound.regrow`."
56
(:require
67
[nrepl.middleware.interruptible-eval :refer [*msg*]]
7-
[refactor-nrepl.ns.slam.hound.search :as search]))
8+
[refactor-nrepl.ns.class-search :as class-search]))
89

910
(def ^:dynamic *cache* (atom {}))
1011
(def ^:dynamic *dirty-ns* (atom #{}))
@@ -15,20 +16,21 @@
1516
(swap! *dirty-ns* conj ns))
1617
(apply f args)))
1718

19+
;; XXX remove this if possible, we shouldn't be this sort of stuff.
1820
(alter-var-root #'clojure.main/repl wrap-clojure-repl)
1921

2022
(defn cache-with-dirty-tracking
2123
"The function to be cached, f, should have two signatures. A zero-operand
2224
signature which computes the result for all namespaces, and a two-operand
2325
version which takes the previously computed result and a list of dirty
2426
namespaces, and returns an updated result."
25-
[key f]
27+
[k f]
2628
(if *cache*
27-
(if-let [cached (get @*cache* key)]
29+
(if-let [cached (get @*cache* k)]
2830
(if-let [dirty (seq @*dirty-ns*)]
29-
(key (swap! *cache* assoc key (f cached dirty)))
31+
(k (swap! *cache* assoc k (f cached dirty)))
3032
cached)
31-
(key (swap! *cache* assoc key (f))))
33+
(k (swap! *cache* assoc k (f))))
3234
(f)))
3335

3436
(defn clear-cache! []
@@ -79,5 +81,5 @@
7981
[type missing _body _old-ns-map]
8082
(case type
8183
:import (into (ns-import-candidates missing)
82-
(get @search/available-classes-by-last-segment missing))
84+
(get @class-search/available-classes-by-last-segment missing))
8385
:refer (get (symbols->ns-syms) missing)))

src/refactor_nrepl/ns/resolve_missing.clj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
[clojure.string :as str]
77
[refactor-nrepl.core :refer [prefix suffix]]
88
[refactor-nrepl.util :refer [self-referential?]]
9-
[refactor-nrepl.ns.slam.hound.regrow :as slamhound]))
9+
[refactor-nrepl.ns.imports-and-refers-analysis :as imports-and-refers-analysis]))
1010

1111
(defn- candidates [sym]
1212
(reduce into
1313
[(when-let [p (prefix sym)]
14-
(slamhound/candidates :import (symbol p) [] {}))
15-
(slamhound/candidates :import (symbol (suffix sym)) [] {})
16-
(slamhound/candidates :refer (symbol (suffix sym)) [] {})]))
14+
(imports-and-refers-analysis/candidates :import (symbol p) [] {}))
15+
(imports-and-refers-analysis/candidates :import (symbol (suffix sym)) [] {})
16+
(imports-and-refers-analysis/candidates :refer (symbol (suffix sym)) [] {})]))
1717

1818
(defn- get-type [sym]
1919
(let [info (info 'user sym)]

test/refactor_nrepl/ns/slam/hound/search_test.clj renamed to test/refactor_nrepl/ns/class_search_test.clj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
(ns refactor-nrepl.ns.slam.hound.search-test
1+
(ns refactor-nrepl.ns.class-search-test
22
(:require
33
[clojure.test :refer [deftest is]]
4-
[refactor-nrepl.ns.slam.hound.search :as sut]))
4+
[refactor-nrepl.ns.class-search :as sut]))
55

66
(def acceptable-error-messages
77
#{"com/github/luben/zstd/ZstdInputStream"

test/refactor_nrepl/ns/slam/hound/regrow_test.clj renamed to test/refactor_nrepl/ns/imports_and_refers_analysis_test.clj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
(ns refactor-nrepl.ns.slam.hound.regrow-test
1+
(ns refactor-nrepl.ns.imports-and-refers-analysis-test
22
(:require
3-
[refactor-nrepl.ns.slam.hound.regrow :as sut]
3+
[refactor-nrepl.ns.imports-and-refers-analysis :as sut]
44
[clojure.test :refer [deftest is]]))
55

66
(deftest works

0 commit comments

Comments
 (0)