This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-06-19
Channels
- # announcements (9)
- # babashka (11)
- # beginners (157)
- # calva (10)
- # cider (18)
- # clara (4)
- # clj-kondo (40)
- # cljsrn (8)
- # clojure (29)
- # clojure-europe (11)
- # clojure-italy (1)
- # clojure-nl (2)
- # clojure-spec (4)
- # clojure-sweden (1)
- # clojure-uk (39)
- # clojurescript (32)
- # conjure (1)
- # core-async (2)
- # cursive (20)
- # datomic (7)
- # duct (9)
- # emacs (1)
- # figwheel-main (1)
- # fulcro (24)
- # helix (1)
- # hoplon (20)
- # hugsql (3)
- # jackdaw (5)
- # jobs-discuss (7)
- # lambdaisland (1)
- # malli (5)
- # music (4)
- # off-topic (54)
- # parinfer (2)
- # pedestal (13)
- # re-frame (12)
- # reagent (22)
- # reitit (9)
- # shadow-cljs (89)
- # spacemacs (2)
- # xtdb (21)
maybe @delaguardo ^?
I already reserve few hours this weekend for that)
This is an example of rewriting a slingshot/try+ call to something clj-kondo understands using the new "hooks" functionality: https://github.com/borkdude/clj-kondo/blob/macros-sci/corpus/.clj-kondo/macroexpand/try_plus.clj
it's not the easiest macro example, but it shows that it's possible to do it. this is an easier one which is syntactically isomorphic to the jdbc with-transaction macro: https://github.com/borkdude/clj-kondo/blob/macros-sci/corpus/.clj-kondo/macroexpand/weird_macro.clj
@martinklepsch so this is a newer version of a hook that can teach clj-kondo about rum defc: https://github.com/borkdude/clj-kondo/blob/81e3e8a66beaf07c011546ff89b7d7358cd00644/corpus/macroexpand.clj#L74-L111
downloaded this binary and added the config to the ns form of a file but it seems to behave as before
I’m pretty sure the right clj-kondo
binary is used
clj-kondo v2020.06.13-SNAPSHOT
it should output:
$ clj-kondo --lint /tmp/rum.clj
/tmp/rum.clj:35:1: error: quux/with-mixin is called with 4 args but expects 1
/tmp/rum.clj:35:13: error: unresolved symbol a
/tmp/rum.clj:37:1: warning: redefined var #'quux/with-mixin
figured it out by trying to trim down my file
the :hooks
key should use the fully qualified macro name
{:clj-kondo/config '{:hooks {rum.core/defc "
before the key was just rum/defc
but these macros live in rum.core
yeah sorry, that was just for my own tests 🙂 I actually don't use rum so I didn't bother to look what the real ns name was 🙂
very very cool though, seems to work great!
my pleasure, very excited to get this into our CI 🙂
if so, then adding a lint-as rule for this should work (it doesn't right now, but it can be made so)
done: https://github.com/borkdude/clj-kondo/blob/macros-sci/corpus/macroexpand.clj#L74-L120 should now work with this binary: https://9930-176829714-gh.circle-artifacts.com/0/release/clj-kondo-2020.06.13-SNAPSHOT-macos-amd64.zip (cc @U0509NKGK)
there’s also defcc but I think it’s also the same
they basically add extra arguments to the function
so as long as the argvec is parsed correctly this should be fine
YAAAAAAAAAAAAY -dance-
Note, the string in the config is only for demo, it may also be a filepath relative to the .clj-kondo directory
Here's a mac binary: https://9926-176829714-gh.circle-artifacts.com/0/release/clj-kondo-2020.06.13-SNAPSHOT-macos-amd64.zip
I might still rename the naming of {:hooks {rum/defc ...}}
since this gets invoked during analysis of a call only. so maybe {:hooks {:analyze-call {rum/defc ...}}}
might be better for future extension
@delaguardo Seems someone worked on including clj-kondo into super-linter: https://github.com/github/super-linter/pull/197
That's even better) now I have free two hours on weekend)
:hugging_face: