Fork me on GitHub
#clj-kondo
<
2023-06-09
>
Noah Bogart15:06:21

$ echo "(let [a 1] (let [b 2] (+ a b)))" | clj-kondo --lang cljc --lint -
<stdin>:1:13: warning: Redundant let expression. [:redundant-let]
linting took 14ms, errors: 0, warnings: 1
should this report twice? when does clj-kondo report a given error in a cljc file twice?

borkdude16:06:22

It deduplicates warnings

👍 2
André Camargo17:06:57

Hello! Just to make sure I got it right how to write hooks: https://github.com/clj-kondo/clj-kondo/blob/master/doc/hooks.md#custom-lint-warnings hooks don't need to return a map with :node, right?

ericdallo17:06:46

wow, I didn't know about that, looks promising

borkdude21:06:53

yeah, you don't have to return anything for custom lint warnings

metal 2
thanks2 2
mac21:06:55

Using typed.clojure is giving me a lot of kondo error noice using doom emacs +lsp. I have tried with a config.edn containing: :config-in-call {typed.clojure/ann {:linters {:ignore true}} typed.clojure/defalias {:linters {:ignore true}} typed.clojure/I {:linters {:ignore true}} but I still get warnings/errors. Any ideas?

borkdude21:06:23

I think you need to get rid of the :linters key

borkdude21:06:54

{:config-in-call {my-ns/ignore {:ignore true}}}

mac22:06:15

Ah, let me try

mac22:06:21

You are of course right abut the :linters key, but I still get warnings and errors in calls to the fucntions/macros. I have deleted both the .lsp folder and the kondon .cache folder. Should it not be ignoring all symbols in and vars inside calls to those functions/macros?

borkdude22:06:49

I think so yes, but I'm about to go to sleep. Meanwhile it would be helpful if you could provide a small repro in the form of a github repo that I could clone and try locally perhaps

borkdude22:06:07

Tomorrow I'm busy with #C04VAK5U86L - will look into it after that

mac22:06:03

Much appreciated. I will give that a shot.

mac23:06:13

So one discovery is that the config.edn works as intended with VS Code but not with emacs.

borkdude00:06:06

if it doesn't work with emacs, perhaps you're running an older version of kondo?

mac00:06:10

I don't think so. I get this: ❯ clojure-lsp --version clojure-lsp 2023.06.04-19.00.17-nightly clj-kondo 2023.06.02-SNAPSHOT but perhaps emacs is using something different?

borkdude05:06:10

can you try to repro from the command line?

borkdude05:06:42

perhaps you have multiple .clj-kondo dirs inside of subdirs of the project?

mac06:06:51

I am getting progress now. I think I had done something silly with lint-as on top of ignoring. There is just one .clj-kondo dir 🙂

mac06:06:49

Is there a good solution to dealing with unresolve vars due to macro generated functions?

borkdude09:06:46

Yes, this is already what config-in-call + ignore is for right

mac09:06:11

Thanks, I did not realise that would also take care of functions generated by the macro.

borkdude09:06:20

oh macro generated functions...

borkdude09:06:21

yeah in that case a hook is probably the best. the :macroexpand hook supports copy-pasting your macro (and usually, simplifying it, just for clj-kondo purposes). Or of the syntax looks like something else, you can use :lint-as , like {:lint-as {your.ns/def-somethings clojure.core/declare}}

mac09:06:54

Cool, thanks.