This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-05-26
Channels
- # ai (1)
- # announcements (7)
- # babashka (2)
- # beginners (23)
- # biff (3)
- # calva (1)
- # chlorine-clover (3)
- # cider (2)
- # clj-kondo (12)
- # clojure (25)
- # clojure-brasil (4)
- # clojure-europe (33)
- # clojure-nl (1)
- # clojure-norway (7)
- # clojure-uk (1)
- # clojurescript (30)
- # clr (6)
- # consulting (1)
- # cursive (14)
- # data-science (1)
- # datalevin (4)
- # datomic (3)
- # events (4)
- # graphql (1)
- # gratitude (2)
- # hoplon (10)
- # inf-clojure (3)
- # interceptors (1)
- # introduce-yourself (1)
- # off-topic (13)
- # pathom (2)
- # pedestal (12)
- # rdf (14)
- # releases (6)
- # sci (17)
- # shadow-cljs (12)
I am trying to analyze a macro call, but I can’t seem to get it completely right: I’ve got this:
(defn defsynth [{:keys [children]}]
(let [[_ synth-name binding-vec & body] children
new-node (api/list-node
(list*
(api/token-node 'def)
synth-name
[(api/list-node
(list*
(api/token-node 'let)
binding-vec
body))]))]
{:node new-node}))
The macro looks like this:
(o/defsynth rev [in 0 out 0 mix 0.5 room 0.8 damp 0.5 amp 1]
(o/out out (* amp (o/free-verb (o/in in) mix room damp))))
And the hook output looks like this:
{:node <list: (def rev (let [in 0 out 0 mix 0.5 room 0.8 damp 0.5 amp 1] (o/out out (* amp (o/free-verb (o/in in) mix room damp)))))>}
It works for defining the vector symbols, but in the places I use it, rev
still appears to not be defined. Also it doesn’t show if there are unused symbols in the let binding or if undefined symbols are used in the body.
Though what I really want is to have rev
understood as being defined.Try with
clj-kondo --lint <src> --debug
on the command line. My suspicion is that some list node is not constructed correctlyalso I find it suspicious that you're destructuring on children
and not on node
or is there another function which receives the node?
I am using this version: “2023.04.15-SNAPSHOT” (on emacs doom, with clojure-lsp)
I also find int suspicious that I am destructing on children, but that’s what I am getting from this:
(-> (api/parse-string
"(o/defsynth rev [in 0 out 0 mix 0.5 room 0.8 damp 0.5 amp 1]
(o/out out (* amp (o/free-verb (o/in in) mix room damp))))")
defsynth)
Am I perhaps doing something wrong?Oh got it, I had to wrap the output of parse-string in a hash-map with the :node
key
thanks!
@fergalbyrne You or your colleague (don't know their name, sorry) asked about midje + clj-kondo at the Funding Circle meetup. I noticed there is an exported configuration in midje here: https://github.com/marick/Midje/tree/master/test-resources/clj-kondo.exports/marick/midje
See here how to "import" that configuration: https://github.com/clj-kondo/clj-kondo/blob/master/doc/config.md#importing
Hey @U04V15CAJ sorry only seeing this now. Yes, that was almost certainly me.. Wow, that is enormously useful, and also shows how to extend/adapt it. It’ll have to be for my next job (we just both finished up with YouView, they’re more or less abandoning Clojure and the type of straightforward people who tend to use it).
https://github.com/clj-kondo/clj-kondo: static analyzer and linter for Clojure code that sparks joy ✨
Just a few bugfixes since the last release!
2023.05.26
• https://github.com/clj-kondo/clj-kondo/issues/2083: fix regression with :missing-test-assertion
introduced in 2023.05.18
• https://github.com/clj-kondo/clj-kondo/issues/2084: add :refers
to :refer-all
finding
• https://github.com/clj-kondo/clj-kondo/issues/2086: false positive missing test assertion with swap!
• https://github.com/clj-kondo/clj-kondo/issues/2087: honor :config-in-comment for :unused-referred-var