This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-12-15
Channels
- # adventofcode (46)
- # announcements (3)
- # aws (7)
- # babashka (47)
- # beginners (86)
- # calva (40)
- # cider (8)
- # clj-kondo (22)
- # clojure (63)
- # clojure-europe (16)
- # clojure-hungary (3)
- # clojure-nl (1)
- # clojure-norway (46)
- # clojure-sweden (1)
- # clojure-uk (3)
- # clojuredesign-podcast (2)
- # conjure (4)
- # datalevin (1)
- # events (1)
- # fulcro (5)
- # graalvm (4)
- # honeysql (8)
- # hyperfiddle (15)
- # music (1)
- # off-topic (5)
- # pathom (7)
- # pedestal (1)
- # polylith (3)
- # portal (19)
- # quil (1)
- # re-frame (36)
- # releases (1)
- # specter (3)
- # sql (3)
- # timbre (11)
- # tools-deps (4)
- # xtdb (55)
If two different namespaces refer the same unresolved var, is it expected that results would only contain one warning about it? In my experiments I’m seeing that’s on most occasions it is only on one of the namespaces and only once it was reported on both. What’s more surprising is that even if I lint just one file that contains the problem - it is not reported. Is it because it uses cached linting result somehow?
we have a number of unresolved vars throughout our code base at work (the vars are there just generated via macros or even in some cases via intern at runtime) and those are reported everywhere they are used across many namespaces
Oh, I see, it was hidden because it was used inside of a macro that was linted with def-catch-all
.
need help writing a hook, @U0NCTKEV8?
It is a whole thing, actually a combination of macros and calling intern, if I recall, where the macros generate the defs from specs in some cases, and that is all in the implementation part of a polylith component and then in the interface part I think it just copies the names using intern
damn, sounds complicated. If you can share the code, I suspect there's a way to make clj-kondo not yell so much.
If there aren’t too many, you can also write (declare foo bar) in the defining namespace
minor caveat to using declare
: it breaks direct linking of the var in question, and in clojurescript, declare
d vars called as functions will always go through the variadic call route, which can result in degraded performance
You can surround it with comment, if you have disabled linting in comment that’s on you ;)
we could also have a way to declare vars about namespaces externally, something like: https://github.com/clj-kondo/clj-kondo/issues/2214#issuecomment-1855046706
oh i forgot code in comment forms are linted, too. that's actually a good workaround, because the comment will document vars that get declared by the macro
Apologies if this has been asked/answered before, but is it possible to write a custom linter that would check if defn
args appear on a new line after the function name?
This is not a style that everyone uses, but my current work likes this for consistency
clj-kondo throws away all whitespace before analysis so currently this isn't something it checks
I brought this up in #C8YT051KN a while ago. I believe they were happy to take a PR for this as long as it a user option to enable.
I haven't had the time to work on it myself.
This isn’t currently checked but it could be added to #C04SCGV2ATX easily
FYI, this is supported in the cljstyle formatter. https://github.com/greglook/cljstyle