Skip to content
Snippets Groups Projects
Commit 9a2d06e5 authored by Braden Shepherdson's avatar Braden Shepherdson Committed by Braden Shepherdson
Browse files

Improve clj-kondo linting of with-temp*

parent 78f2799b
No related branches found
No related tags found
No related merge requests found
......@@ -16,8 +16,6 @@
(clojure.core.logic/matcha)
(clojure.core.logic/run)
(clojure.test/is [query= sql= partial=])
(toucan.util.test/with-temp*)
(metabase.test/with-temp*)
(taoensso.nippy/extend-freeze)
(taoensso.nippy/extend-thaw)
(metabase.driver.druid.query-processor-test/druid-query-returning-rows)
......@@ -396,6 +394,8 @@
metabase.test/query hooks.metabase.test.data/$ids
metabase.test/run-mbql-query hooks.metabase.test.data/$ids
metabase.test/with-temp hooks.toucan.util.test/with-temp
metabase.test/with-temp* hooks.toucan.util.test/with-temp*
metabase-enterprise.serialization.test-util/with-temp-dpc hooks.toucan.util.test/with-temp*
metabase.test/with-temporary-setting-values hooks.metabase.test.util/with-temporary-setting-values
metabase.test.data/$ids hooks.metabase.test.data/$ids
metabase.test.data/dataset hooks.metabase.test.data/dataset
......
(ns hooks.toucan.util.test
(:require [clj-kondo.hooks-api :as api]))
(defn- with-temp-inner [body bindings]
(let [pairs (partition 2 bindings)
db-refs (map first pairs)
let-stream (for [[_ binding+opts] pairs
part (:children binding+opts)]
part)]
(api/vector-node [(api/vector-node db-refs)
(api/list-node (list* (api/token-node `let)
(api/vector-node let-stream)
body))])))
(defn with-temp [{:keys [node]}]
(let [[_ db-ref binding+opts & body] (:children node)
[args opts] (:children binding+opts)]
{:node (api/vector-node [db-ref
opts
(api/list-node (list* (api/token-node 'fn)
(api/vector-node [args])
body))])}))
(let [[_ db-ref binding+opts & body] (:children node)]
{:node (with-temp-inner body [db-ref binding+opts])}))
(defn with-temp* [{:keys [node]}]
(let [[_ bindings & body] (:children node)]
{:node (with-temp-inner body (:children bindings))}))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment