This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-06-14
Channels
- # babashka (43)
- # beginners (47)
- # biff (1)
- # calva (16)
- # cider (7)
- # clerk (6)
- # clj-kondo (39)
- # cljdoc (49)
- # clojure (29)
- # clojure-brasil (1)
- # clojure-europe (93)
- # clojure-losangeles (1)
- # clojure-norway (34)
- # conjure (7)
- # datalevin (8)
- # events (1)
- # gratitude (3)
- # honeysql (6)
- # hyperfiddle (2)
- # introduce-yourself (1)
- # javascript (1)
- # jobs-discuss (9)
- # lsp (3)
- # malli (10)
- # off-topic (8)
- # pedestal (3)
- # rewrite-clj (2)
- # shadow-cljs (17)
- # sql (33)
- # vim (1)
- # xtdb (31)
When I do:
clj-kondo --lint .
it finds 0 warnings
But when I do it on specific directory like:
clj-kondo --lint bb/
It finds the warning.
Same when I do it on specific file that the warning should be in:
clj-kondo --lint bb/src/core.clj
It finds warning.
Any idea why?
馃槥 Any idea how to debug it? When I do clj-kondo --debug it prints the namespace, so it is scanned. And I'm on the newest clj-kondo version
clj-kondo v2023.05.26
Okay we've found the error. The problem is we had: bb/src/core.clj docker_images/gha/src/core.clj And that was causing the issue that there were two files with the same namespace.
There was no warning that the same namespace was defined twice from clj-kondo
Not sure if it's a good idea yet, but how would people feel if clj-kondo supported this:
(defn foo [^:clj-kondo/long x] (inc x))
(foo "foo") ;; type error
It seems those hints can live aside normal type hints like ^String ^:clj-kondo/string x
getting more type errors through static analysis. but having these annotations littered over your code might not be so nice
Are type hints like that or presence of destructuring already used as input to clj-kondo?
oooh, good to know
"presence of destructuring" not sure what you meant with this. presence of destructuring doesn't mean that the input it always a map, since technically it's safe to call get
on anything
That鈥檚 true, but I personally never use destructuring when I would want to put something else there. So I think I would appreciate the possibility of using this information on my projects when I make a mistake. For instance I would consider it a bug if I feed a string to something where I am using destructuring
So this could serve as additional metadata to narrow the requirements for an argument?
Yes. You can already use malli to accomplish the same. https://github.com/metosin/malli#clj-kondo But not everybody wants to bring in malli or something else to their libraries
Perhaps a more general library agnostic scheme could also be useful, that malli and clj-kondo and .. could agree upon.
Is it decided how clj-kondo would handle cases where there are multiple specifications are present from #{type-hint malli clj-kondo ...}
?
@U08BJGV6E malli + clj-kondo just works because malli emits the clj-kondo configuration on disk which clj-kondo then uses. clj-kondo doesn't know anything about malli
i'm struggling to find in the docs, my apologies if it's obvious: how do i tell clj-kondo that a given cljc
file will only be used in clj and bb, and NOT cljs?
ah thank you
it will actually only use known features, so it will also skip bb unfortunately, this is still work in progress
no worries
is that what this error message is about?
src/noahtheduke/splint/utils.cljc:0:0: error: Can't parse src/noahtheduke/splint/utils.cljc, No matching clause: :bb [:syntax]
yeah, for sure. no rush from me, this is an easy fix