clj-kondo

https://github.com/clj-kondo/clj-kondo
ericdallo 2021-05-07T16:52:47.426Z

Question: Shouldn't https://github.com/clj-kondo/clj-kondo/issues/598#issuecomment-551948021 be a default on clj-kondo?

ericdallo 2021-05-07T16:53:00.426200Z

Since it's from clojure.test

borkdude 2021-05-07T17:39:25.426400Z

It's not clojure.test but it is one of the "core" libraries, so yes, I think we should have built-in support for it

ericdallo 2021-05-07T17:40:19.426600Z

yeah, it'd be nice

ericdallo 2021-05-07T20:24:51.427600Z

Is it possible to add a hook to understand https://github.com/marick/Midje/wiki/Tabular-facts custom vars? ๐Ÿงต

borkdude 2021-05-07T20:25:36.427800Z

anything is possible with hooks

๐Ÿช„ 1
ericdallo 2021-05-07T20:25:55.427900Z

for example:

(tabular
  (fact "foo"
    (+ ?a ?b) => ?res)
  ?a ?b ?res
  1  2  3)

borkdude 2021-05-07T20:26:26.428500Z

it seems like an are macro gone wild (in my opinion the are macro is already quite wild)

ericdallo 2021-05-07T20:27:01.429100Z

yes, I don't like it either ๐Ÿ˜… but is used in a lot of legacy projects

ericdallo 2021-05-07T20:27:25.429900Z

But I imagine a lot of people use midje and would like to have that working nice

ericdallo 2021-05-07T20:27:52.430400Z

so, I imagine a hook built-in in the lib would be the best, right? (like we did for state-flow)

borkdude 2021-05-07T20:29:45.430600Z

what's state-flow again?

borkdude 2021-05-07T20:29:59.430900Z

yeah, either in the midje or clj-kondo/config lib

๐Ÿ‘ 1
ericdallo 2021-05-07T20:32:04.431Z

the "new" midje hahah https://github.com/nubank/state-flow

ericdallo 2021-05-07T20:32:29.431200Z

that uses clojure.test as base

ericdallo 2021-05-07T20:33:23.432200Z

so, how the hook would mark the ?foo vars as locals , is there any hook that makes that as an example?

borkdude 2021-05-07T21:09:13.432500Z

@ericdallo The built-in core.match support would be something to look at

1
borkdude 2021-05-07T21:12:39.434100Z

it is different because it calls other clj-kondo internals directly, so it doesn't first macro-expand into something else, but it might give some ideas

borkdude 2021-05-07T21:16:59.435700Z

the best way to think about hooks is probably: write a macro-expansion that translates your code into built-in clojure forms, but it doesn't actually have to work, as long as the generated code can be linted. And then rewrite the macro-expansion into code that actually moves around/generates nodes instead of s-expressions.

ericdallo 2021-05-07T21:35:01.436200Z

It makes sense! thank you!