This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-01-27
Channels
- # announcements (1)
- # aws (10)
- # babashka (53)
- # calva (133)
- # clj-kondo (46)
- # cljdoc (6)
- # cljs-dev (33)
- # clojure (105)
- # clojure-boston (1)
- # clojure-europe (11)
- # clojure-nl (4)
- # clojure-poland (1)
- # clojure-switzerland (6)
- # clojure-uk (13)
- # clojurescript (106)
- # cursive (1)
- # datascript (2)
- # emacs (13)
- # events (1)
- # figwheel-main (4)
- # fulcro (17)
- # graphql (8)
- # heroku (2)
- # honeysql (8)
- # lsp (76)
- # luminus (30)
- # malli (12)
- # meander (23)
- # music (1)
- # nextjournal (83)
- # off-topic (6)
- # pathom (3)
- # polylith (19)
- # re-frame (8)
- # reagent (2)
- # reveal (3)
- # shadow-cljs (54)
- # sql (9)
- # testing (11)
- # tools-deps (15)
- # xtdb (14)
Hi. Is there some doc on something like: https://github.com/seancorfield/next-jdbc/blob/9433b86b7120555bd5b127139eec4ba80eded40e/resources/clj-kondo.exports/com.github.seancorfield/next.jdbc/hooks/com/github/seancorfield/next_jdbc.clj#L4. so that I can instruct clj kondo to correctly treat my macro?
I remember previously the doc mentions next.jdbc and now that piece is missing. Maybe my memory is wrong.
I am importing java.sql.Savepoint
but I’d like to use java.sql.Savepoint
as the fullname instead of only Savepoint
. Clj-kondo is now complaining unused import of java.sql.Savepoint
.
you don't need to import if you're using the full name
import just makes Savepoint
resolve to java.sql.Savepoint
, it's not actually need to cause loading or anything
no, you don't need to do that
it's different than require
Just to make sure, the JVM loads the java.sql.Savepoint only when I use it, right? And this magic is performed by clojure runtime under the hood.
when you need the Class object it will be loaded
(and import
does not load)
> when I use it, right Slight clarification: it's being loaded when the compiler resolves the class name, not when the interop on that class is actually executed.
So when you have a file like:
(ns foo) java.sql.Savepoint (defn foo [])
and you load that namespace, then the class is also loadedOK, this cool PR by @pfeodrippe was just merged to master. clj-kondo should now be able to infer some more type-related errors with (nested) maps. As this was a non-trivial commit, please lint your sources and report any regressions :) You can do so with:
clojure -Sdeps '{:deps {clj-kondo/clj-kondo {:git/url "" :git/sha "bcad7ea524d0c706c77610c829298a118220ee29"}}}' -M -m clj-kondo.main --lint src
(replace src
with your source(s))You did all the grunt work in the end, thanks, man o/
i’m guessing this is out of scope for the PR, right?
(let [{:keys [c]} {:c :f}]
(inc c))
I guess we could treat {:keys [c]}
as (:c ...)
and then continue with the code as usual
Just as a heads up, I'm getting this error on clj-kondo 2022.01.15
Suspicious state from syntax checker clj-kondo-cljc: Flycheck checker clj-kondo-cljc returned 2, but its output contained no errors: /home/jsusk/Programming/Projects/Clojure/farolero/src/cljc/farolero/core.cljc::: warning: Missing catch or finally in try
linting took 167ms, errors: 0, warnings: 1
Try installing a more recent version of clj-kondo-cljc, and please open a bug report if the issue persists in the latest release. Thanks!
when running on my project farolero. It is correct that there are try
without catch
, but it seems to be getting confused about the location.
https://github.com/IGJoshua/farolero/blob/master/src/cljc/farolero/core.cljc#L82-L88 🧵So it's intentional that there's a try without a catch here, specifically because the intention here is that I want to prevent a recur
to the function there.
I'm perfectly fine with kondo emitting a warning, but it's not specifying a source location, and I'm confused why.
Maybe it's a bug that it's not got the source location?
I'm not sure. Are you using a hook to lint this code? Then there might not be a location attached to the node
Oh, yeah, that's probably true because it's one of the constructed nodes that's added to the code.
So how could I fix this, do I need to emit a comment node or something to tell kondo not to lint my macro with this linter?
Right, but then kondo wouldn't complain about recur there
and that's why the try was put in there in the first place
I think I could just emit an empty finally block
that might work
That worked. Glad it's not a bug.
Thanks again for kondo, I love it!
yeah, so far every time it's emitted a warning without a location it's been something that told me something was up with my hooks, so I think they're useful.