Fork me on GitHub
#clj-kondo
<
2024-07-26
>
borkdude18:07:21

I'm working on a new feature in clj-kondo that detects if a macro is used as a value.

$ clj -Sdeps '{:deps {clj-kondo/clj-kondo {:git/sha "96344bd32257afdebf19ee634999c397000c1aa0" :git/url ""}}}
' -M -m clj-kondo.main --lint - <<< '(inc let)'
:1:6: error: Can't take value of a macro: clojure.core/let
linting took 48ms, errors: 1, warnings: 0
Please test it out. I'm not sure if the balance between helpful and annoying is ok-ish since there are macros that just receive unquoted symbols that sometimes refer to macros, e.g.:
(my-cool-macro [binding 10]) ;; Can't take the value of a macro: clojure.core/binding
So it might be good to test this over your codebase and report false positives to me.