This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-03-02
Channels
- # announcements (9)
- # babashka (67)
- # beginners (62)
- # bitcoin (2)
- # clara (1)
- # clj-kondo (62)
- # cljfx (6)
- # cljs-dev (25)
- # clojars (17)
- # clojure (142)
- # clojure-australia (2)
- # clojure-europe (42)
- # clojure-gamedev (2)
- # clojure-nl (31)
- # clojure-poland (10)
- # clojure-spec (14)
- # clojure-uk (30)
- # clojurescript (3)
- # conjure (1)
- # cursive (10)
- # data-science (1)
- # datascript (4)
- # datomic (9)
- # depstar (7)
- # fulcro (17)
- # girouette (15)
- # graalvm (44)
- # honeysql (20)
- # jackdaw (3)
- # jobs (8)
- # jobs-discuss (10)
- # juxt (5)
- # lein-figwheel (1)
- # lsp (175)
- # malli (19)
- # pedestal (2)
- # reagent (31)
- # reitit (2)
- # remote-jobs (3)
- # reveal (12)
- # sci (77)
- # shadow-cljs (22)
- # specter (6)
- # startup-in-a-month (2)
- # tools-deps (1)
- # xtdb (21)
Any reason why clj-kondo warns about only the first unresolved-symbol/namespace of the same symbol?
if I have the same unresolved symbol/ns multiple times on the file, clj-kondo only warn the first occurrence
I see, clojure-lsp uses the findings to know if should try to suggest a add-require ns
I don't think so, we get the findings of the current line, we don't iterate over all the findings of the buffer
so on a big buffer, I need to search the first occurrence of the unresolved var to apply the code action
As a user, why would I apply the action on the second unresolved ns instead of the first?
Imagine a big buffer, where I has the foo/bar
on the start of the buffer and on the end, IMO I want to be able to apply the code action on both places, otherwise I need to find the first occurrence
that's how cursive handles that too.
but the code action only applies something to the ns form. why would you need all places?
With a code of:
(ns my-ns)
(def some-func []
(string/split "some-func" #"-"))
;; lots of code
(def other-func []
(string/split "other-func" #"-"))
I only get a unresolved ns on the first string/split
, I'd like to have the same warn on the second split, otherwise that looks a correct code.
Also without that finding, there is no way clojure-lsp knows that there is a unresolved ns without that findingso if I try to lsp-execute-code-action
on the last string/split
, clojure-lsp will suggest no Add missing clojure.string require
It just seems odd to me, clj-kondo don't report about all the occurrences of a lint, I know this can be sometimes to much info, but is actually a code that is missing something indeed, just like other IDEs and languages do AFAIK
But why would I apply the code action on the second one, if I already see that the first one isn't right, at the moment of typing it?
that's the issue, If I copy a lot of code for another buffer/ns I'll need to check from top to bottom
We could make this an option in clj-kondo, but I would prefer that the user keeps seeing it as it is now
The reason is that clj-kondo might be wrong and it's really annoying if your buffer is littered with false positives
a clj-kondo flag looks good to me as we could have users migrating from other IDEs and having this behavior. I agree that would be a lot of warnings, but all of them correct, right?
Even in LSP I would prefer if the display was the same, although you could have all of them as data
I think we can have a hammock time for that, but that is something I always missed from clj-kondo before clojure-lsp 😛 Could be just me, but I prefer a warning if my code is not right and not need to check the whole buffer for the same symbol or something
I think if you have a false positive, you need to fix that somehow first, otherwise you will already have some warning somewhere about that
The issue is, like I already explained: if clj-kondo is wrong, which it can be, then it's irritating to have 60 errors instead of just 1.
And right now, you can get rid of those, by only ignoring 1 warning with #_:clj-kondo/ignore
. This won't work if we emit all of them. Please put that in an issue.
I see, it's a tradeoff indeed, other languages follow this way though, like dart, you can suppress a single warning in a buffer just like #_:clj-kondo/ignore
, but still other lines will warn about that.
Sure, I'll open a issue later about that, thanks 🙂
I think this should be a user preference and not a clojure-lsp opinion. We can make toggles for this per linter config
Actually, I'm the same. I always wondered why it only showed the first but not the others. I wouldn't mind it being a toggle. False positives I can deal with 🙂
I'm linting a file that has some xml namespaces created via clojure.data.xml/alias-uri. How do I best fix/suppress the unresolved namespace errors for ::<alias>/<keyword>
?
@danieleneal I just fixed this in the latest version, released Sunday
wow! That's great - how does it work, do I need to do anything special in config?
@danieleneal No, should work out of the box
I'll try now
Perfect 🙂
Hi there, is there a way to tell clj-kondo
not to warn me in case of defmulti
"unused" bindings?
I basically like to leave them there as part of the documentation of the defmulti
I could, if that was the only way
but it feels like a hack
I think it's the usual convention. Not sure if there is a config specific for defmulti.
I see, thanks, it might be worth an issue but I am going to wait to see if borkdude is around
This question has come up more than a couple of times and I think it's good to make an option for this
e.g. this question was asked today here: https://clojureverse.org/t/clj-kondo-and-defmulti/7290/3
kk thanks @U04V15CAJ will open one