Fork me on GitHub
#clj-kondo
<
2020-02-20
>
tatut12:02:26

anyone used clj-kondo with github actions to lint PRs?

tatut13:02:57

I'm having trouble with unresolved symbols in my own macro... exclusion doesn't seem to work

tatut13:02:36

my macro has its own binding form which are used in the body... I can actually give you a link example

borkdude13:02:35

I prefer a repro in the form:

$ clj-kondo --config '{}' --lint - <<< '(defmacro foo [])'
or
$ clj-kondo --config '{}' --lint file.clj

borkdude13:02:56

which makes it less of a hassle to test it out

tatut13:02:26

just to be clear, it reports errors at the macro uses, not the definition

borkdude13:02:56

that's mostly where these issues happen. but that can also be repro'd in the same fashion

tatut13:02:29

$ clj-kondo --config '{:linters {:unresolved-symbols {:exclude [(repro/foo)]}}}' --lint - <<< '(ns repro) (defmacro foo [bind & body] nil) (foo these should not be reported)'
<stdin>:1:27: warning: unused binding bind
<stdin>:1:34: warning: unused binding body
<stdin>:1:50: error: unresolved symbol these
<stdin>:1:56: error: unresolved symbol should
<stdin>:1:67: error: unresolved symbol be
<stdin>:1:70: error: unresolved symbol reported
linting took 13ms, errors: 4, warnings: 2

tatut13:02:52

If I understand correctly, none of those symbols should be reported becaus repro/foo has been marked as excluded

borkdude13:02:01

$ clj-kondo --config '{:linters {:unresolved-symbol {:exclude [(repro/foo)]}}}' --lint - <<< '(ns repro) (defmacro foo [bind & body] nil) (foo these should not be reported)'
<stdin>:1:27: warning: unused binding bind
<stdin>:1:34: warning: unused binding body
linting took 10ms, errors: 0, warnings: 2
typo?

tatut13:02:01

ah, typo in my config... that makes sense

borkdude13:02:43

I'm thinking of a --diagnose flag for clj-kondo which lists unexpected things from the config

tatut13:02:54

that would be nice

borkdude13:02:59

and prints a lot of other stuff to debug

tatut13:02:28

thanks for the help, I had a feeling it might be between keyboard and chair on this end 😛

borkdude13:02:38

the --diagnose flag would also come in handy so I can ask people to paste their configuration in a Github issue

borkdude13:02:44

and stacktraces, etc