clj-kondo

https://github.com/clj-kondo/clj-kondo
robert-stuttaford 2021-03-24T10:14:19.121600Z

<snip>

borkdude 2021-03-24T10:27:37.122600Z

@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

👍 1
robert-stuttaford 2021-03-24T10:50:47.123200Z

thank you! https://github.com/borkdude/edamame/discussions/80

snoe 2021-03-24T20:43:13.125500Z

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 -
&lt;stdin&gt;:1:1: error: unresolved symbol foo
linting took 35ms, errors: 1, warnings: 0

borkdude 2021-03-24T20:45:13.126Z

@snoe clj-kondo only outputs the first unresolved symbol as to not flood users with the same type of warning

borkdude 2021-03-24T20:45:34.126500Z

this also ties into #_:clj-kondo/ignore: ignoring the first one, ignores all the next unresolved symbols of the same name

snoe 2021-03-24T20:46:21.127400Z

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.

snoe 2021-03-24T20:46:59.128Z

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)

borkdude 2021-03-24T20:48:03.128900Z

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

snoe 2021-03-24T20:48:40.129600Z

gotcha, sorry must have missed it. Is it only that linter that ignores?

borkdude 2021-03-24T20:49:32.130500Z

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

borkdude 2021-03-24T20:50:22.131100Z

let me point you to the code

borkdude 2021-03-24T20:50:44.131400Z

sorry, gotta go for a half an hour first

👍 1
borkdude 2021-03-24T20:53:24.133Z

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

🙏 1
borkdude 2021-03-24T20:53:34.133400Z

(now afk for a bit)

borkdude 2021-03-24T20:59:10.133900Z

we could e.g. change the map values to vectors

borkdude 2021-03-24T20:59:29.134100Z

and by default only report the first one

snoe 2021-03-24T21:00:56.134500Z

would you like to keep the overwriting from a perf perspective?

borkdude 2021-03-25T07:49:10.142900Z

Unresolved namespace

snoe 2021-03-24T21:07:38.134800Z

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.

borkdude 2021-03-24T21:19:41.135Z

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

👍 1
borkdude 2021-03-24T21:20:21.135300Z

what do you mean from a perf perspective?

snoe 2021-03-24T21:22:10.135500Z

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.

snoe 2021-03-24T21:22:35.135700Z

I'm thinking to your comments about destructuring and such

borkdude 2021-03-24T21:54:32.135900Z

Ah, right. I think unresolved-symbols are the unhappy path, there should be relatively few of them, so I think that would be ok