diff --git a/.clj-kondo/config.edn b/.clj-kondo/config.edn index eaa30934..c1a0f014 100644 --- a/.clj-kondo/config.edn +++ b/.clj-kondo/config.edn @@ -5,5 +5,8 @@ :private-call {:level :off} :mount/defstate {:level :warning}} + :lint-as {manifold.deferred/let-flow clojure.core/let} :config-paths ["slingshot"] - :hooks {:analyze-call {mount.core/defstate hooks.defstate/defstate}} } + :hooks {:analyze-call {mount.core/defstate hooks.defstate/defstate + auto-ap.logging/with-context-as hooks.logging/with-context-as + auto-ap.logging/capture-context->lc hooks.logging/capture-context->lc}} } diff --git a/.clj-kondo/hooks/logging.clj b/.clj-kondo/hooks/logging.clj new file mode 100644 index 00000000..4e803380 --- /dev/null +++ b/.clj-kondo/hooks/logging.clj @@ -0,0 +1,18 @@ +(ns hooks.logging + (:require [clj-kondo.hooks-api :as api])) +(defn with-context-as [{:keys [:node]}] + (let [[_ _ binding & body ] (:children node)] + {:node + (api/list-node + (list* + (api/token-node 'let) + (api/vector-node [binding {}]) + body))})) + +(defn capture-context->lc [{:keys [:node]}] + {:node + (api/list-node + (list* + (api/token-node 'let) + (api/vector-node [(api/token-node 'lc) {}]) + (:children node)))})