Skip to content

Commit c8aad53

Browse files
authored
maintenance (#146)
* maint: ci: bump setup-clojure * maint: ci: bump cache action * maint: ci: bump checkout action * maint: ci: bump setup-java action * maint: ci: switch java distribution: adopt -> zulu Adopt is defunct. Switch to zulu (which you are also using on bb fs). * maint: dev: bump babashka fs * maint: dev: bump clojure tools build * maint: dev: bump cljs-test-runner * maint: dev: bump clj-1.11 alias to current 1.11 * maint: dev: update clj-kondo lib imports Move to non-legacy `./clj-kondo/imports` * maint: ci: also test against clojure 1.12 * maint: dev: drop clj-1.9 alias, min clj is 1.10 * maint: ci: remove `-i windows` from `bb test` This implies run tests that have metadata that includes windows. I don't think this makes sense today. * test: add report Print out each test name with platform Extra feedback is nice and this helps to quickly see that we are running on the platform we intended.
1 parent 712b15c commit c8aad53

17 files changed

Lines changed: 205 additions & 19 deletions

File tree

.clj-kondo/babashka/fs/config.edn

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
(ns babashka.fs
2+
(:require [clj-kondo.hooks-api :as api]))
3+
4+
(defn- symbol-node? [node]
5+
(and (api/token-node? node)
6+
(symbol? (api/sexpr node))))
7+
8+
(defn with-temp-dir
9+
[{:keys [node]}]
10+
(let [args (rest (:children node))
11+
binding-like-vector (first args)
12+
body (rest args)]
13+
(when-not (zero? (count args)) ;; let clj-kondo report on arity
14+
(if-not (api/vector-node? binding-like-vector)
15+
(api/reg-finding! (assoc (meta binding-like-vector)
16+
:message "babashka.fs/with-temp-dir requires a vector for first arg"
17+
:type :babashka-fs/with-temp-dir-first-arg-not-vector))
18+
(let [[binding-sym options & rest-in-vec] (:children binding-like-vector)]
19+
(when (not (symbol-node? binding-sym))
20+
(api/reg-finding! (assoc (meta (or binding-sym binding-like-vector))
21+
:message "babashka.fs/with-temp-dir vector arg requires binding-name symbol as first value"
22+
:type :babashka-fs/with-temp-dir-vector-arg-needs-binding-symbol)))
23+
(doseq [extra-vector-arg rest-in-vec]
24+
(api/reg-finding! (assoc (meta extra-vector-arg)
25+
:message "babashka.fs/with-temp-dir vector arg accepts at most 2 values"
26+
:type :babashka-fs/with-temp-dir-vector-arg-extra-value)))
27+
28+
(when binding-sym
29+
{:node (api/list-node
30+
;; satisfy linter by creating binding for for binding-sym
31+
(list*
32+
(api/token-node 'let)
33+
;; it doesn't really matter what we bind to, so long as it is bound
34+
(api/vector-node [binding-sym (api/token-node nil)])
35+
options ;; avoid unused binding when options is a binding
36+
body))}))))))
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{:linters {:babashka-fs/with-temp-dir-first-arg-not-vector {:level :error}
2+
:babashka-fs/with-temp-dir-vector-arg-needs-binding-symbol {:level :error}
3+
:babashka-fs/with-temp-dir-vector-arg-extra-value {:level :error}}
4+
:hooks {:analyze-call {babashka.fs/with-temp-dir babashka.fs/with-temp-dir}}}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{:hooks {:macroexpand {sci.core/copy-ns sci.core/copy-ns}}}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
(ns sci.core)
2+
3+
(defmacro copy-ns
4+
([ns-sym sci-ns]
5+
`(copy-ns ~ns-sym ~sci-ns nil))
6+
([ns-sym sci-ns opts]
7+
`[(quote ~ns-sym)
8+
~sci-ns
9+
(quote ~opts)]))

.clj-kondo/borkdude/deflet/borkdude/deflet.clj_kondo renamed to .clj-kondo/imports/borkdude/deflet/borkdude/deflet.clj_kondo

File renamed without changes.
File renamed without changes.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
{:hooks
3+
{:analyze-call {org.httpkit.server/with-channel httpkit.with-channel/with-channel}}}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
(ns httpkit.with-channel
2+
(:require [clj-kondo.hooks-api :as api]))
3+
4+
(defn with-channel [{node :node}]
5+
(let [[request channel & body] (rest (:children node))]
6+
(when-not (and request channel) (throw (ex-info "No request or channel provided" {})))
7+
(when-not (api/token-node? channel) (throw (ex-info "Missing channel argument" {})))
8+
(let [new-node
9+
(api/list-node
10+
(list*
11+
(api/token-node 'let)
12+
(api/vector-node [channel (api/vector-node [])])
13+
request
14+
body))]
15+
16+
{:node new-node})))
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{:lint-as
2+
{rewrite-clj.zip/subedit-> clojure.core/->
3+
rewrite-clj.zip/subedit->> clojure.core/->>
4+
rewrite-clj.zip/edit-> clojure.core/->
5+
rewrite-clj.zip/edit->> clojure.core/->>}}

0 commit comments

Comments
 (0)