Fork me on GitHub
#lsp
<
2023-06-06
>
Martynas Maciulevičius11:06:05

What do you think about https://github.com/clj-commons/kibit? Do you think it's reasonable to have something like this in Clojure-LSP?

teodorlu11:06:47

I was wondering what kibit gave that's better than what already works out of the box. Both kibit and clojure-lsp warn on this code:

(if (some? [1 2 3])         ; lsp: "Missing else branch. [missing-else-branch]
  [:action])
But I don't get any LSP warnings from this code from the kibit README:
(if (some? [1 2 3])
  [:action]
  nil)

teodorlu11:06:18

Personally, I'd be interested in getting that warning from LSP. I'm not planning on installing any other static analysis tools than Clojure-lsp any time soon.

ericdallo11:06:17

Yes, most of the things are done by clj-kondo under the hood, so we could improve kondo if it makes sense c/c @U04V15CAJ

Martynas Maciulevičius11:06:06

Ah, alright. I only wanted to know whether kibit project is already irrelevant.

borkdude11:06:22

I personally don't think we have to warn for:

(if (some? [1 2 3])
  [:action]
  nil)
A linter is for warning on silly/accidental mistakes, but the above expression seems pretty intentional to me. I'm also not interested in when-not vs (when (not ..)) etc, these things just make you fight the linter when you're writing code imo. There is #splint which is a rewrite of kibit which has a lot of these things. The best "linters" I want to have in clj-kondo but probably not all of them. I ported (+ x 1) vs. (inc x) for example, which has real benefits. Make clj-kondo issues, upvote existing ones and/or PR, this is how it works.

💯 6
👍 2
Noah Bogart13:06:57

Thanks for the Splint mention, @U04V15CAJ. I mostly agree. Something like Splint and Kibit are good for running manually to see what comes up, but I don't necessarily suggest using them while actively coding because the things they care about can be distracting to the goal of producing correct behavior.

Noah Bogart13:06:52

If you do want to get them running in your editor, reach out in #C04SCGV2ATX or in the github tracker and I'll help you set up something separate from clj-kondo or lsp

borkdude13:06:25

I think you could re-use flycheck-clj-kondo for example and tweak it so use splint, it's only a few lines of code

👍 2
borkdude13:06:49

in vim you can use ale, probably

👍 2
borkdude13:06:20

for vscode, there's clojure-lint (written by @U0K592YDP) which called out to the clj-kondo binary, same idea