Skip to content

Commit 8ed09c2

Browse files
committed
Enforce the usage of str as alias for clojure.string
1 parent 729c172 commit 8ed09c2

File tree

5 files changed

+36
-36
lines changed

5 files changed

+36
-36
lines changed

.clj-kondo/config.edn

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
(cider.nrepl.print-method/def-print-method)
1111
(cljs.test/is [match? thrown-match?])
1212
(clojure.test/is [match? thrown-match?])]}
13+
:consistent-alias {:aliases {clojure.string str}}
1314
:unused-import {:level :off}
1415
:unresolved-var {:level :off}
1516
:unused-binding {:level :off}

maint/cider/nrepl/impl/docs.clj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
[cider.nrepl.version :as version]
66
[clojure.tools.cli :as cli]
77
[clojure.java.io :as io]
8-
[clojure.string :as string]
8+
[clojure.string :as str]
99
[nrepl.core :as nrepl]
1010
[nrepl.server :as server]
1111
[nrepl.transport :as transport])
@@ -32,11 +32,11 @@
3232
""
3333
"Options:"
3434
options-summary]
35-
(string/join \newline)))
35+
(str/join \newline)))
3636

3737
(defn- error-msg [errors]
3838
(str "The following errors occurred while parsing your command:\n\n"
39-
(string/join \newline errors)))
39+
(str/join \newline errors)))
4040

4141
(def built-in-ops
4242
"A list of nREPL built-in ops.
@@ -84,9 +84,9 @@ use in e.g. wiki pages, github, etc."
8484
(defn- adoc-escape
8585
[s]
8686
(some-> s
87-
(string/replace #"\*(.+?)\*" "\\\\*$1*")
88-
(string/replace #"\_(.+?)\_" "\\\\_$1_")
89-
(string/escape {\` "``"})))
87+
(str/replace #"\*(.+?)\*" "\\\\*$1*")
88+
(str/replace #"\_(.+?)\_" "\\\\_$1_")
89+
(str/escape {\` "``"})))
9090

9191
(defn- message-slot-adoc
9292
[msg-slot-docs]

test/clj/cider/nrepl/middleware/inspect_test.clj

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
[cider.nrepl.middleware.info-test :as info-test]
77
[cider.test-helpers :refer :all]
88
[clojure.edn :as edn]
9-
[clojure.string :as string]
9+
[clojure.string :as str]
1010
[clojure.test :refer :all]
1111
[orchard.java]
1212
[orchard.inspect]
@@ -468,43 +468,43 @@
468468

469469
(deftest max-atom-length-integration-test
470470
(let [max-len (:max-atom-length @#'orchard.inspect/default-inspector-config)
471-
xs #(string/join (repeat % "x"))
471+
xs #(str/join (repeat % "x"))
472472
fits (pr-str [(xs (- max-len 10))]) ;; 140
473473
too-long (pr-str [(xs (* max-len 2))]) ;; 300
474474
x-pattern #(str "\"" (xs %1) %2 "\\\"")
475475
extract-text #(-> % :value first)]
476476

477477
(testing "max atom length can be set for the eval op"
478-
(is (string/includes? (-> (session/message {:op "eval"
479-
:inspect "true"
480-
:code fits})
478+
(is (str/includes? (-> (session/message {:op "eval"
479+
:inspect "true"
480+
:code fits})
481481
extract-text)
482482
(x-pattern (- max-len 10) "")))
483-
(is (string/includes? (-> (session/message {:op "eval"
484-
:inspect "true"
485-
:code too-long})
483+
(is (str/includes? (-> (session/message {:op "eval"
484+
:inspect "true"
485+
:code too-long})
486486
extract-text)
487487
(x-pattern max-len "...")))
488-
(is (string/includes? (-> (session/message {:op "eval"
489-
:inspect "true"
490-
:code too-long
491-
:max-atom-length 10})
488+
(is (str/includes? (-> (session/message {:op "eval"
489+
:inspect "true"
490+
:code too-long
491+
:max-atom-length 10})
492492
extract-text)
493493
(x-pattern 10 "..."))))
494494

495495
(testing "max atom length can be changed without re-eval'ing last form"
496496
(session/message {:op "inspect-clear"})
497-
(is (string/includes? (-> (session/message {:op "eval"
498-
:inspect "true"
499-
:code too-long})
497+
(is (str/includes? (-> (session/message {:op "eval"
498+
:inspect "true"
499+
:code too-long})
500500
extract-text)
501501
(x-pattern max-len "...")))
502-
(is (string/includes? (-> (session/message {:op "inspect-refresh"
503-
:max-atom-length 10})
502+
(is (str/includes? (-> (session/message {:op "inspect-refresh"
503+
:max-atom-length 10})
504504
extract-text)
505505
(x-pattern 10 "...")))
506-
(is (string/includes? (-> (session/message {:op "inspect-refresh"
507-
:max-atom-length 20})
506+
(is (str/includes? (-> (session/message {:op "inspect-refresh"
507+
:max-atom-length 20})
508508
extract-text)
509509
(x-pattern 20 "..."))))))
510510

@@ -535,7 +535,7 @@
535535
big-coll (format "[(range %d)]" big-size)
536536
coll-pattern (fn [len & [truncate]]
537537
(re-pattern (format "\\(%s%s\\)"
538-
(string/join " " (range len))
538+
(str/join " " (range len))
539539
(if truncate " ..." ""))))
540540
extract-text #(-> % :value first)]
541541

@@ -591,9 +591,9 @@
591591
:inspect "true"
592592
:code nested-coll
593593
:max-nested-depth 5})]
594-
(is (string/includes? (extract-text default)
594+
(is (str/includes? (extract-text default)
595595
"\"[[[[[[[[[[1]]]]]]]]]]\""))
596-
(is (string/includes? (extract-text limited)
596+
(is (str/includes? (extract-text limited)
597597
"\"[[[[[[...]]]]]]\""))))
598598

599599
(testing "max nested depth can be changed without re-eval'ing last form"
@@ -603,9 +603,9 @@
603603
:code nested-coll})
604604
limited (session/message {:op "inspect-refresh"
605605
:max-nested-depth 5})]
606-
(is (string/includes? (extract-text default)
606+
(is (str/includes? (extract-text default)
607607
"\"[[[[[[[[[[1]]]]]]]]]]\""))
608-
(is (string/includes? (extract-text limited)
608+
(is (str/includes? (extract-text limited)
609609
"\"[[[[[[...]]]]]]\""))))))
610610

611611
(def normal-mode-prefix

test/clj/cider/nrepl/middleware/test_test.clj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
[cider.nrepl.middleware.test :as test]
44
[cider.nrepl.test-session :as session]
55
[cider.test-helpers :refer :all]
6-
[clojure.string :as string]
76
[clojure.test :refer :all]
87
[matcher-combinators.clj-test]
98
[matcher-combinators.matchers :as matchers]

test/clj/cider/nrepl/middleware/xref_test.clj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
(ns cider.nrepl.middleware.xref-test
22
(:require
33
[cider.nrepl.test-session :as session]
4-
[clojure.string :as string]
4+
[clojure.string :as str]
55
[clojure.test :refer :all]))
66

77
(use-fixtures :each session/session-fixture)
@@ -27,8 +27,8 @@
2727
(pr-str response))
2828
(assert (seq x))
2929
(doseq [i x]
30-
(is (or (string/starts-with? i "file:")
31-
(string/starts-with? i "jar:file:")))))))
30+
(is (or (str/starts-with? i "file:")
31+
(str/starts-with? i "jar:file:")))))))
3232

3333
(deftest fn-deps-integration-test
3434
(let [response (session/message {:op "fn-deps" :ns "cider.nrepl.middleware.xref-test" :sym "foo"})
@@ -47,5 +47,5 @@
4747
(map :file-url))]
4848
(assert (seq x))
4949
(doseq [i x]
50-
(is (or (string/starts-with? i "file:")
51-
(string/starts-with? i "jar:file:")))))))
50+
(is (or (str/starts-with? i "file:")
51+
(str/starts-with? i "jar:file:")))))))

0 commit comments

Comments
 (0)