Fork me on GitHub
#clj-kondo
<
2021-05-07
>
ericdallo16:05:00

Since it's from clojure.test

borkdude17:05:25

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

ericdallo17:05:19

yeah, it'd be nice

ericdallo23:02:13

Just faced this again facepalm I should have opened a issue ๐Ÿ˜‚

ericdallo20:05:51

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

ericdallo20:05:55

for example:

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

borkdude20:05:36

anything is possible with hooks

๐Ÿช„ 2
borkdude20:05:26

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

ericdallo20:05:01

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

ericdallo20:05:25

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

ericdallo20:05:52

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

borkdude20:05:45

what's state-flow again?

ericdallo20:05:29

that uses clojure.test as base

borkdude20:05:59

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

๐Ÿ‘ 2
ericdallo20:05:23

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

borkdude21:05:13

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

thanks 2
borkdude21:05:39

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

borkdude21:05:59

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.

ericdallo21:05:01

It makes sense! thank you!