Fork me on GitHub
#clj-kondo
<
2021-08-20
>
ericdallo18:08:45

I have a false-positive from clj-kondo that I'd like to understand if it's an issue or not ๐Ÿงต

ericdallo18:08:56

(ns foo
  (:require
   [clojure.string :refer [split-lines]])) ;; gives unused-namespace + unured-reffered-var

#?(:clj
   (split-lines ""))

ericdallo18:08:24

If I move the require to a #?(:clj ) it works, but that way should work as well, right?

ericdallo18:08:09

clojure-lsp removes the require from ns when the require is unused, this kind of issue could be really bad for clojure-lsp clean-ns feature ๐Ÿ˜•

borkdude19:08:35

I see the problem, but I think the analysis info provides enough info for the clean-ns to not remove this: e.g. one usage is enough to not clean it

borkdude19:08:13

from the clj-kondo perspective: the linting happens twice, once for the clj branches and once for the cljs branches

ericdallo19:08:16

yeah, but it seems a workaround right? fix the root issue seems the right choice?

ericdallo19:08:42

even if we fix on clojure-lsp, it's still a warning on clj-kondo that is a false-positive ๐Ÿ˜•

ericdallo19:08:59

> from the clj-kondo perspective: the linting happens twice, once for the clj branches and once for the cljs branches Is that easy to fix?

ericdallo19:08:07

Should I open an issue?

borkdude19:08:30

no, this is not an issue, it is just how it works and how it has always works: it's intended

ericdallo19:08:55

๐Ÿ˜ฎ even if it's a valid used code, is it right report as unused?

borkdude19:08:23

it is unused in cljs. there's an issue to add to the linting "cljs" so it's more clear

ericdallo19:08:20

I would prefer not to check the analysis for performance reasons as ATM we are only relying on findings

ericdallo19:08:46

We would need to rely on analysis only because of this specific case

borkdude19:08:10

we can add some more info to the findings perhaps: a lang key

borkdude19:08:34

and if there are not two the same findings for both languages, you should not remove?

borkdude19:08:59

or we can enhance the unused-* linters to behave the way you expected them

borkdude19:08:08

with a setting

ericdallo19:08:34

yeah, that would be the perfect from clojure-lsp view, but that other idea of enhance the findings would work as well I think

borkdude21:08:01

with the enhanced findings you would not be depending on what the user would configure, so that seems more stable right?

borkdude21:08:35

another thing to look out for is when we will change the message to include the language (clj or cljs) then LSP should only look at other fields like :lang and :ns and :name perhaps

borkdude21:08:53

I'm not sure if we already include those

borkdude21:08:14

are you depending on the exact format of the message in some cases? I hope not?

ericdallo21:08:52

No, only the code

ericdallo21:08:08

invalid-arity for example

borkdude22:08:07

Hey, what's the easiest way to setup neovim with clojure-lsp? neovim now has the lsp client built in right?

borkdude22:08:22

I want @U051N6TTC to try out clojure-lsp ;)

ericdallo22:08:48

Yes, It has it built-in, but I don't know anything from nvim side besides that :/

ericdallo22:08:11

He needs to install clojure-lsp, first, this is what I know hahaha

borkdude22:08:23

quoll = she

๐Ÿ‘ 2
ericdallo22:08:40

I think he uses CoC

ericdallo22:08:03

Maybe @UMMMKKADU knows, he uses nvim

rafaeldelboni22:08:10

I'm using a super fancy nvim/fennel setup, but as @UKFSJSM38 said Nvim 0.5 has a built-in LSP and you just need a plugin to setup which is this one: https://github.com/neovim/nvim-lspconfig

rafaeldelboni22:08:38

This in company of https://github.com/hrsh7th/nvim-compe for auto completion and https://github.com/nvim-telescope/telescope.nvim#neovim-lsp-pickers for fancy menus and pickers is all you need

ericdallo22:08:38

Thanks, we really need a tutorial mentioning all of that :p

rafaeldelboni22:08:06

coc-nvim bundles all of this in one, but is written in nodejs, people is jumping out

rafaeldelboni22:08:39

Hahaha I will, I just migrated for the native stuff, but you right.

๐Ÿ˜† 2