<snip>
@robert-stuttaford Please move the question as a Q/A here: https://github.com/borkdude/edamame/discussions/categories/q-a We can continue the discussion over there, as this doesn't really belong in this channel
thank you! https://github.com/borkdude/edamame/discussions/80
it seems kondo does some sort of deduplication of findings. is there a way to output findings for the duplicates?
$ printf "foo\nfoo" | clj-kondo --lint -
<stdin>:1:1: error: unresolved symbol foo
linting took 35ms, errors: 1, warnings: 0
@snoe clj-kondo only outputs the first unresolved symbol as to not flood users with the same type of warning
this also ties into #_:clj-kondo/ignore
: ignoring the first one, ignores all the next unresolved symbols of the same name
is it possible to turn that off? it's really annoying in the editor to play whack a mole, fixing the first and having the second pop up.
makes a lot of sense from the command line, but maybe the count of 1 error is misleading in the same way (with a flag obvs)
It's currently not possible. I have discussed this with @ericdallo before as well and I suggested making an option for this in the unresolved-symbol linter
gotcha, sorry must have missed it. Is it only that linter that ignores?
no, but the ignore is applied to a later phase then where the unresolved findings are emitted, so when you ignore the first one, the other part of the code still thinks there is one, let's say
let me point you to the code
sorry, gotta go for a half an hour first
so what happens: https://github.com/clj-kondo/clj-kondo/blob/76143d350946c18cd3ffc425b35aa01a6c78561d/src/clj_kondo/impl/namespace.clj#L267 unresolved symbols are kept in a map. when there is already one in the map, it is not overwritten (as to not generate multiple) I copied this behavior from joker and personally I liked it but I'm open to optionally change it
(now afk for a bit)
we could e.g. change the map values to vectors
and by default only report the first one
would you like to keep the overwriting from a perf perspective?
Unresolved namespace
Another question, where would you like the config flag? {:skip-duplicates true}
alongside skip-args
feels right but it seems like only unresolved-vars
and unresolved-symbols
has this property so it might feel inconsistent.
I think the option should go into each linter separately.
I think also unresolved-namespace has it.
I think it should be something like :report-duplicates true
so not having this property defaults to nil
what do you mean from a perf perspective?
I guess there could potentially be a large vector underlying the linter, if report-duplicates is false, it might make more garbage than you're comfortable with.
I'm thinking to your comments about destructuring and such
Ah, right. I think unresolved-symbols are the unhappy path, there should be relatively few of them, so I think that would be ok