Skip to content

Commit cd8c5c7

Browse files
committed
Add more libraries to lib tests
We now also run unit tests for following libries against rewrite-clj v1: - depot - kibit - lein-ancient - mutant Update docs to track what we lib test in README only. Was formerly also tracking in design notes and developer user guide.
1 parent c8d15e5 commit cd8c5c7

File tree

4 files changed

+116
-59
lines changed

4 files changed

+116
-59
lines changed

README.adoc

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -42,36 +42,38 @@ See https://github.com/clj-commons/rewrite-clj/projects/1[project page for curre
4242
** link:doc/design/01-merging-rewrite-clj-and-rewrite-cljs.adoc[Merging rewrite-clj and rewrite-cljs]
4343
* link:doc/03-faq.adoc[FAQ]
4444

45+
[[used-in]]
4546
== Used In...
4647

4748
Some projects using rewrite-clj v1
4849

49-
* https://github.com/liquidz/antq[antq] ^t^
50-
* https://github.com/borkdude/carve[carve] ^t^ (in dev)
51-
* https://github.com/clojure-lsp/clojure-lsp[clojure-lsp] ^t^ (in dev)
52-
* https://github.com/borkdude/rewrite-edn[rewrite-edn] ^t^
53-
* https://github.com/lread/test-doc-blocks[test-doc-blocks]
50+
* https://github.com/liquidz/antq[antq] ^🐥^
51+
* https://github.com/borkdude/carve[carve] ^🐥^ (in dev)
52+
* https://github.com/clojure-lsp/clojure-lsp[clojure-lsp] ^🐥^ (in dev)
53+
* https://github.com/borkdude/rewrite-edn[rewrite-edn] ^🐥^
54+
* https://github.com/lread/test-doc-blocks[test-doc-blocks] ^🐥^
5455

5556
Some projects using rewrite-clj v0 and/or rewrite-cljs
5657

57-
* https://github.com/mauricioszabo/atom-chlorine[atom-chlorine]
58-
* https://github.com/weavejester/cljfmt[cljfmt] ^t^
59-
* https://github.com/greglook/cljstyle[cljstyle] ^t^ ^h^
60-
* https://github.com/Olical/depot[depot]
61-
* https://github.com/jonase/kibit[kibit]
62-
* https://github.com/xsc/lein-ancient[lein-ancient]
63-
* https://github.com/benedekfazekas/mranderson[mranderson] ^t^
64-
* https://github.com/jstepien/mutant[mutant]
65-
* https://github.com/juxt/pack.alpha[pack (alpha)]
66-
* https://github.com/clojure-emacs/refactor-nrepl[refactor-nrepl] ^t^
67-
* https://github.com/mauricioszabo/repl-tooling[repl-tooling]
68-
* https://github.com/atomist-skills/update-leiningen-dependencies-skill[update-leiningen-dependencies-skill]
69-
* https://github.com/kkinnear/zprint[zprint] ^t^ ^h^
58+
* https://github.com/mauricioszabo/atom-chlorine[atom-chlorine] ^📍^
59+
* https://github.com/weavejester/cljfmt[cljfmt] ^🐥^
60+
* https://github.com/greglook/cljstyle[cljstyle] ^🐥^ ^🩹^
61+
* https://github.com/Olical/depot[depot] ^🐥^ ^🩹^
62+
* https://github.com/jonase/kibit[kibit] ^🐥^
63+
* https://github.com/xsc/lein-ancient[lein-ancient] ^🐥^
64+
* https://github.com/benedekfazekas/mranderson[mranderson] ^🐥^
65+
* https://github.com/jstepien/mutant[mutant] ^🐥^
66+
* https://github.com/juxt/pack.alpha[pack (alpha)] ^📍^
67+
* https://github.com/clojure-emacs/refactor-nrepl[refactor-nrepl] ^🐥^
68+
* https://github.com/mauricioszabo/repl-tooling[repl-tooling] ^📍^
69+
* https://github.com/atomist-skills/update-leiningen-dependencies-skill[update-leiningen-dependencies-skill] ^📍^
70+
* https://github.com/kkinnear/zprint[zprint] ^🐥^ ^🩹^
7071

7172
Have an update? Let us know!
7273

73-
^t^ [.small]#included in rewrite-clj v1 link:doc/02-developer-guide.adoc#libs-test[lib test suite]# +
74-
^h^ [.small]#required minor change to work with rewrite-clj v1#
74+
^🐥^ [.small]#canary tested against rewrite-clj v1 link:doc/02-developer-guide.adoc#libs-test[lib test suite]# +
75+
^🩹^ [.small]#source required minor change to work with rewrite-clj v1# +
76+
^📍^ [.small]#no easy to run unit tests found for this project#
7577

7678
== Versioning
7779

doc/02-developer-guide.adoc

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -210,18 +210,7 @@ To try to ensure our changes to rewrite-clj do not inadvertently break existing
210210
bb ./script/libs_tests.clj run
211211
----
212212

213-
Current libs we test against:
214-
215-
* antq
216-
* carve
217-
* cljfmt
218-
* cljstyle
219-
* clojure-lsp
220-
* mranderson
221-
* rewrite-edn
222-
* refactor-nrepl
223-
* test-doc-blocks
224-
* zprint
213+
See link:../README.adoc#used-in[README] for current libs we test against.
225214

226215
Additional libs are welcome.
227216

doc/design/01-merging-rewrite-clj-and-rewrite-cljs.adoc

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -77,121 +77,105 @@ We'll happily continue with `rewrite-clj` for rewrite-clj v1 work:
7777
I've tried to make note of popular/active projects that make use of rewrite-clj v0 and rewrite-cljs.
7878
I've linked where I've explicitly verified a migration to rewrite-clj v1.
7979

80-
[cols="15%,20%,20%,15%,30%"]
80+
See README for up to date list of which libraries directly use so form of rewrite-clj and which ones we are currently link:#canary-testing[canary testing].
81+
82+
[cols="15%,20%,20%,55%"]
8183
|===
82-
| Project | rewrite‑clj? | rewrite‑cljs? | link:#canary-testing[Canary Tested?] | Notes
84+
| Project | rewrite‑clj? | rewrite‑cljs? | Notes
8385

8486
| https://github.com/mauricioszabo/atom-chlorine[chlorine]
8587
|
8688
| yes
87-
|
88-
| REPL support for Atom editor
89+
| REPL support for Atom editor. +
90+
I do not see easy to run unit tests for this project.
8991

9092
| https://github.com/borkdude/clj-kondo[clj-kondo]
9193
| custom version
9294
|
93-
|
9495
| uses an internal custom version of rewrite-clj
9596

9697
| https://github.com/weavejester/cljfmt[cljfmt]
9798
| yes
9899
| yes
99-
| yes
100100
| source code formatter
101101

102102
| https://github.com/greglook/cljstyle[cljstyle]
103103
| yes
104104
|
105-
|
106105
| source code formatter based on cljfmt
107106

108107
| https://github.com/snoe/clojure-lsp[clojure-lsp]
109108
| yes
110109
|
111-
| yes
112110
| language server for Clojure
113111

114112
| https://github.com/Olical/depot[depot]
115113
| yes
116114
|
117-
|
118115
| find newer versions of your deps.edn dependencies
119116

120117
| https://github.com/jonase/kibit[kibit]
121118
| yes
122119
|
123-
|
124120
| Finds non-idiomatic Clojure code
125121

126122
| https://github.com/xsc/lein-ancient[lein-ancient]
127123
| yes
128124
|
129-
|
130125
| find newer versions of your lein dependencies
131126

132127
| https://github.com/benedekfazekas/mranderson[MrAnderson]
133128
| yes
134129
|
135-
| yes
136130
| Dependency inliner
137131

138132
| https://github.com/jstepien/mutant[mutant]
139133
| yes
140134
|
141-
|
142135
| Source code mutator
143136

144137
| https://github.com/juxt/pack.alpha[pack (alpha)]
145138
| yes
146139
|
147-
|
148140
| Clojure project packager
149141

150142
| https://github.com/bhauman/rebel-readline[rebel-readline]
151143
| indirectly via cljfmt
152144
|
153-
|
154145
| smart editing at at the REPL terminal, optionally used in conjunction with https://github.com/bhauman/figwheel-main[figwheel-main]
155146

156147
| https://github.com/cognitect-labs/REBL-distro[REBL]
157148
| indirectly via cljfmt
158149
|
159-
|
160150
| graphical interactive tool for browsing Clojure data
161151

162152
| https://github.com/clojure-emacs/refactor-nrepl[refactor-nrepl]
163153
| yes
164154
|
165-
| yes
166155
| refactoring support used in conjunction with https://github.com/clojure-emacs/cider[cider]
167156

168157
| https://github.com/mauricioszabo/repl-tooling[repl-tooling]
169158
|
170159
| yes
171-
|
172-
| base package for Clojure editor tooling. Interesting: uses rewrite-clj.reader directly.
160+
| base package for Clojure editor tooling. Interesting: uses rewrite-clj.reader directly. +
161+
I do not see easy to run unit tests for this project.
173162

174163
| https://github.com/atomist-skills/update-leiningen-dependencies-skill[update-leiningen-dependencies-skill]
175164
|
176165
| yes
177-
|
178166
| dependency version tracker, great for a migration test of a project that uses shadow-cljs
179167

180168
| https://github.com/kkinnear/zprint[zprint]
181169
| yes
182170
| yes
183-
| yes
184171
| source code formatter
185172

186173
|===
187174

188175
[#rewrite-clj-v1-libs]
189176
== Projects Using rewrite-clj v1
190-
We have at least three early adopters, for all of which we do link:#canary-testing[canary testing]:
191177

192-
* https://github.com/liquidz/antq[antq]
193-
* https://github.com/borkdude/carve[carve]
194-
* https://github.com/borkdude/rewrite-edn[rewrite-edn]
178+
See README for up to date list.
195179

196180
[#canary-testing]
197181
== Canary Testing

script/libs_tests.clj

Lines changed: 84 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,44 @@
230230
"java.lang.Exception: Unexpected"
231231
"clojure.lang.ExceptionInfo: Unexpected"))
232232

233+
;;
234+
;; depot
235+
;;
236+
(defn depot-patch [{:keys [home-dir rewrite-clj-version]}]
237+
(patch-deps {:filename (str (fs/file home-dir "deps.edn"))
238+
:removals #{'rewrite-clj/rewrite-clj}
239+
:additions {'rewrite-clj/rewrite-clj {:mvn/version rewrite-clj-version}}})
240+
(patch-rewrite-cljc-sources home-dir)
241+
(status/line :detail "=> depot uses but does not require rewrite-clj.node, need to adjust for rewrite-clj v1")
242+
(replace-in-file (str (fs/file home-dir "src/depot/zip.clj"))
243+
"[rewrite-clj.zip :as rzip]"
244+
"[rewrite-clj.zip :as rzip] [rewrite-clj.node]"))
245+
246+
;;
247+
;; kibit patch
248+
;;
249+
(defn- kibit-patch [{:keys [home-dir rewrite-clj-version]}]
250+
(patch-deps {:filename (str (fs/file home-dir "project.clj"))
251+
:removals #{'rewrite-clj 'org.clojure/clojure}
252+
:additions [['rewrite-clj rewrite-clj-version]
253+
['org.clojure/clojure "1.9.0"]]}))
254+
255+
;;
256+
;; lein ancient
257+
;;
258+
(defn- lein-ancient-patch [{:keys [home-dir rewrite-clj-version]}]
259+
(status/line :detail "=> Patching deps")
260+
(let [p (str (fs/file home-dir "project.clj"))]
261+
(-> p
262+
slurp
263+
;; done with exercising my rewrite-clj skills for now! :-)
264+
(string/replace #"rewrite-clj \"[0-9.]+\""
265+
(format "rewrite-clj \"%s\"" rewrite-clj-version))
266+
;; lein-ancient uses pedantic? :abort, so need to match clojure versions
267+
(string/replace #"\[org.clojure/clojure .*\]"
268+
"[org.clojure/clojure \"1.10.3\" :scope \"provided\"]")
269+
(->> (spit p)))))
270+
233271
;;
234272
;; mranderson
235273
;;
@@ -245,6 +283,15 @@
245283
"[$1 :exclusions [org.clojure/tools.reader]]")
246284
(->> (spit p)))))
247285

286+
;;
287+
;; mutant
288+
;;
289+
(defn- mutant-patch [{:keys [home-dir rewrite-clj-version]}]
290+
(patch-deps {:filename (str (fs/file home-dir "project.clj"))
291+
:removals #{'rewrite-clj 'org.clojure/clojure}
292+
:additions [['rewrite-clj rewrite-clj-version]
293+
['org.clojure/clojure "1.9.0"]]}))
294+
248295
;;
249296
;; refactor-nrepl
250297
;;
@@ -353,6 +400,32 @@
353400
:patch-fn clojure-lsp-patch
354401
:show-deps-fn lein-deps-tree
355402
:test-cmds [["lein" "test"]]}
403+
{:name "depot"
404+
:platforms [:clj]
405+
:note "1 patch required due to using, but not requiring, rewrite-clj.node"
406+
:version "2.1.0"
407+
:github-release {:repo "Olical/depot"
408+
:version-prefix "v"}
409+
:patch-fn depot-patch
410+
:show-deps-fn cli-deps-tree
411+
:test-cmds [["bin/kaocha" "--reporter" "documentation"]]}
412+
{:name "kibit"
413+
:platforms [:clj]
414+
:root "kibit"
415+
:version "0.1.8"
416+
:github-release {:repo "jonase/kibit"}
417+
:patch-fn kibit-patch
418+
:show-deps-fn lein-deps-tree
419+
:test-cmds [["lein" "test-all"]]}
420+
{:name "lein-ancient"
421+
:platforms [:clj]
422+
:version "1.0.0-RC3"
423+
:github-release {:repo "xsc/lein-ancient"
424+
:via :tag
425+
:version-prefix "v"}
426+
:patch-fn lein-ancient-patch
427+
:show-deps-fn lein-deps-tree
428+
:test-cmds [["lein" "test"]]}
356429
{:name "mranderson"
357430
:version "0.5.3"
358431
:platforms [:clj]
@@ -362,10 +435,19 @@
362435
:patch-fn mranderson-patch
363436
:show-deps-fn lein-deps-tree
364437
:test-cmds [["lein" "test"]]}
365-
{;; has a release on clojars but no release in GitHub repo
366-
:name "rewrite-edn"
438+
{:name "mutant"
439+
:version "0.2.0"
440+
:platforms [:clj]
441+
:note "Dormant project"
442+
:github-release {:repo "jstepien/mutant"
443+
:via :tag}
444+
:patch-fn mutant-patch
445+
:show-deps-fn lein-deps-tree
446+
:test-cmds [["lein" "test"]]}
447+
{:name "rewrite-edn"
367448
:version "8f75cf124984c6c4494df93ce10359de8beb588d"
368449
:platforms [:clj]
450+
:note "has a relase on clojars but no release in GitHub repo"
369451
:github-release {:repo "borkdude/rewrite-edn"
370452
:via :sha}
371453
:patch-fn deps-edn-v1-patch

0 commit comments

Comments
 (0)