Skip to content

Commit

Permalink
kondo lib export config
Browse files Browse the repository at this point in the history
  • Loading branch information
lread committed Aug 11, 2023
1 parent a521b4b commit ad921c9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .clj-kondo/http-kit/http-kit/config.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

{:hooks
{:analyze-call {org.httpkit.server/with-channel httpkit.with-channel/with-channel}}}
16 changes: 16 additions & 0 deletions .clj-kondo/http-kit/http-kit/httpkit/with_channel.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
(ns httpkit.with-channel
(:require [clj-kondo.hooks-api :as api]))

(defn with-channel [{node :node}]
(let [[request channel & body] (rest (:children node))]
(when-not (and request channel) (throw (ex-info "No request or channel provided" {})))
(when-not (api/token-node? channel) (throw (ex-info "Missing channel argument" {})))
(let [new-node
(api/list-node
(list*
(api/token-node 'let)
(api/vector-node [channel (api/vector-node [])])
request
body))]

{:node new-node})))

0 comments on commit ad921c9

Please sign in to comment.