This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-01-25
Channels
- # announcements (3)
- # asami (63)
- # babashka (5)
- # babashka-sci-dev (32)
- # beginners (56)
- # calva (2)
- # cider (28)
- # clj-commons (9)
- # clj-kondo (16)
- # cljdoc (41)
- # cljs-dev (19)
- # clojure (67)
- # clojure-europe (15)
- # clojure-nl (1)
- # clojure-poland (1)
- # clojure-uk (2)
- # clojurescript (27)
- # community-development (10)
- # data-science (2)
- # datascript (8)
- # datomic (21)
- # events (3)
- # fulcro (54)
- # graalvm (18)
- # introduce-yourself (2)
- # juxt (3)
- # lsp (6)
- # music (1)
- # nextjournal (8)
- # off-topic (44)
- # omni-trace (1)
- # reitit (13)
- # releases (3)
- # rewrite-clj (4)
- # shadow-cljs (10)
- # spacemacs (6)
- # sql (12)
- # tools-build (17)
- # tools-deps (3)
- # web-security (1)
I found https://www.braveclojure.com/writing-macros/
(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?@john.t.richardson.dev 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 clojure.tools.logging 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.
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
Also, doing a hook might be fun little thing to do eventually in my spare time ๐