This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-05-03
Channels
- # aleph (7)
- # announcements (6)
- # babashka (34)
- # beginners (5)
- # calva (1)
- # cider (3)
- # clerk (11)
- # clj-http (1)
- # clj-kondo (35)
- # clojars (6)
- # clojure (114)
- # clojure-australia (1)
- # clojure-brasil (2)
- # clojure-europe (73)
- # clojure-hamburg (3)
- # clojure-nl (1)
- # clojure-norway (27)
- # clojure-uk (4)
- # events (3)
- # graalvm (13)
- # gratitude (4)
- # helix (17)
- # hoplon (1)
- # hyperfiddle (65)
- # instaparse (4)
- # jobs-discuss (6)
- # lsp (2)
- # meander (2)
- # rdf (4)
- # re-frame (51)
- # reitit (28)
- # releases (1)
- # sci (20)
- # shadow-cljs (9)
- # tools-deps (4)
- # xtdb (44)
Is it expected that using :lint-as
def-catch-all
will not set :defined-by
in :var-definitions
?
some parts in clj-kondo rely on defined-by, so if you lint-as def than that may give you behavior that you would not get otherwise
I did stumble on an issue from 2021 about including context in analysis, maybe relevant?
Equally annoying, using :lint-as {ns/<> clojure.core/def}
will set :defined-by
to clojure.core/def
rather than to ns/<>
Fwiw, Iām trying to identify uses of is
inside of defspec
. And this is making it difficult š
Does it make sense clj-kondo include splint for code shape lint? https://github.com/NoahTheDuke/splint
I think it has good ideas so maybe some of those ideas could be ported to clj-kondo. The model is a bit different though: it just looks at the shape and not at the resolved var (so you can't distuingish from locals for example) and this could lead to false positives. The most popular of those linters we could maybe just port directly. The matching idea is pretty cool. Including another linter inside of clj-kondo will also negatively affect performance and hence editor feedback, so this would have to be carefully considered.
I've tested it's performance on a "big" project and it took a few seconds for the entire project, linting a single file may be pretty fast. But I didn't tested enough on single files
I didn't get why can't distinguish from locals and lead to false positives, can you explain noob friendly? Some example will help š
That's true I got it
hi, I built splint. I experimented with this and clj-kondo is tightly coupled to evaluation/scoping, making it hard to find a single point to drop in a call to splint/check-form
or similar.
I decided to build splint to not over-burden clj-kondo, and given their relative speeds, I don't think it's burdensome to run both; I see clj-kondo as helpful when actively developing, whereas I see splint as helpful after finishing a period of work (before committing or in CI).
you can do a splint/check-form thing on analyze-expression** where every rewrite-clj expression is passed through, but I'm mostly concerned about the performance hit that this will incur and false positive (so I think I'd rather match on the analyzed stuff than the raw nodes)
perhaps there is a way to do this, but I haven't found it necessary, as things that I find really important can just be baked into clj-kondo
Agreed
in clj-kondo the matching ("is this thing inside the other thing") is usually implemented by lookup upwards in the "callstack"
Can I configure clj-kondo
to lint files which don't have any ns
declarations?
Say I have a file
src/main/clojure/a.clj
(defn+ ... )
and another file
src/main/clojure/b.clj
(ns main.clojure.b)
(defmacro defn+ ...)
I would like to be able to hover over defn+
in a.clj
and look at the
docstring, arglist, etc. I am using VSCode and Calva. Is this out of scope for clj-kondo
?It doesn't, but I was wondering if it would be possible through configuration. Something like -> For a specific file, or every file under a specific path, lint it as if its contents were defined in another namespace.
Gotcha, thanks!