Question: Shouldn't https://github.com/clj-kondo/clj-kondo/issues/598#issuecomment-551948021 be a default on clj-kondo?
Since it's from clojure.test
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
yeah, it'd be nice
Is it possible to add a hook to understand https://github.com/marick/Midje/wiki/Tabular-facts custom vars? ๐งต
anything is possible with hooks
for example:
(tabular
(fact "foo"
(+ ?a ?b) => ?res)
?a ?b ?res
1 2 3)
it seems like an are
macro gone wild (in my opinion the are
macro is already quite wild)
yes, I don't like it either ๐ but is used in a lot of legacy projects
But I imagine a lot of people use midje and would like to have that working nice
so, I imagine a hook built-in in the lib would be the best, right? (like we did for state-flow)
what's state-flow again?
yeah, either in the midje or clj-kondo/config lib
the "new" midje hahah https://github.com/nubank/state-flow
that uses clojure.test as base
so, how the hook would mark the ?foo
vars as locals
, is there any hook that makes that as an example?
@ericdallo The built-in core.match support would be something to look at
https://github.com/clj-kondo/clj-kondo/blob/master/src/clj_kondo/impl/analyzer/match.clj
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
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.
It makes sense! thank you!