Fork me on GitHub

I found

(ns macro-test.core)

(defn criticize-code [criticism code]
  `(println ~criticism (quote ~code)))

(defmacro code-critic
  [good bad]
  `(do ~@(map #(apply criticize-code %)
              [["this is bad code: " bad]
               ["this is good code: " good]])))

(code-critic (1 + 1) (+ 1 1))     

clj-kondo  --lint /tmp/macro_test/src/macro_test/core.clj
/private/tmp/macro_test/src/macro_test/core.clj:13:14: error: a number is not a function
linting took 13ms, errors: 1, warnings: 0
clj-kondo highlights the (1 +1) part as an error. From my very limited understand of macros, (1 + 1) should be ignored since itโ€™s in a syntax quote. Is this the sort of thing Iโ€™d have to fix with a hook?

borkdude09:01:54 That's the sort of thing you could fix with a hook, but there are other options as well


At work we use (for better or worse) timbre as a logging library. I notice in impl/analyzer.clj there are is a check at lines 2033-2039 for analyzing infof debugf etc., Considering that timbre is a popular library for logging, would you be open to a PR that also adds taoensso.timbre/infof debugf etc... for those to be included in analysis?


I'd like to support this via hooks if possible. The built-in support for many libraries came from a time when hooks didn't exist yet.


Ah yes, of course, since you would have to bring in the dep, right? in deps.edn


Hooks don't need the dep, but I think it's better if support for libraries are built using hooks, since they can evolve independently from the installed clj-kondo version and can be maintained by others than me as well


Perhaps for now you could also use :lint-as for those macros


if the syntax is similar


Yes, very similar and yup easy enough to add that ๐Ÿ™‚


Also, doing a hook might be fun little thing to do eventually in my spare time ๐Ÿ™‚


If it can be done using :lint-as that would be my preference


hooks are cool, but usually only needed for macros that have a non-standard syntax compared to core ones


yes, that sounds best


just trying it out


Yup, works grand