This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-12-09
Channels
- # adventofcode (197)
- # announcements (25)
- # aws (1)
- # babashka (21)
- # beginners (138)
- # calva (21)
- # cider (5)
- # clara (1)
- # clj-kondo (35)
- # clojure (97)
- # clojure-australia (4)
- # clojure-dev (37)
- # clojure-europe (100)
- # clojure-nl (2)
- # clojure-spec (7)
- # clojure-uk (36)
- # clojurescript (11)
- # conjure (15)
- # cursive (20)
- # datomic (12)
- # emacs (10)
- # events (2)
- # fulcro (83)
- # graalvm (14)
- # jobs (1)
- # jobs-discuss (27)
- # kaocha (75)
- # lambdaisland (21)
- # off-topic (27)
- # pedestal (5)
- # reitit (2)
- # reveal (20)
- # rewrite-clj (24)
- # sql (9)
- # tools-deps (37)
- # xtdb (93)
Sweet! Just while I was looking for it. I was about to try to write it out, but I'm still pretty new to clojure. So i was scratching my head a little on this one (the rum hook does look like a good place to start though)
The docs for hooks are here: https://github.com/borkdude/clj-kondo/blob/master/doc/hooks.md
@borkdude Just spotted this in the analysis of deps.edn
:
#:worldsingles{worldsingles-test
#:local{:root "../worldsingles-test"}}
and clj-kondo
flags worldsingles-test
as being an unqualified lib name (which it isn't). I guess clj-kondo
isn't reading namespaced-maps correctly?And it actually recommends changing the above to this, which is definitely wrong:
{worldsingles-test {:local/root "../worldsingles-test"}}/{worldsingles-test {:local/root "../worldsingles-test"}}
Interesting, thanks for the ping! I should have a look at how clj-kondo is using rewrite-clj here and make sure we are properly covered for rewrite-cljc.
It could in fact be a bug in my own fork of rewrite-clj now I think about it. I'll hold off on releasing clj-kondo for today and take a look.
I'm calling sexpr on those nodes... and probably my version of sexpr for this thing doesn't work correctly... https://github.com/borkdude/clj-kondo/blob/master/src/clj_kondo/impl/linters/deps_edn.clj
hmm, it does appear to work:
user=> (n/sexpr (p/parse-string "#:foo{:a 1}"))
#:foo{:a 1}
yeah, namespaced element support is weak in rewrite-clj but my notes say that particular case is covered.
Hmm, this looks wrong:
user=> (n/sexpr (p/parse-string "#:worldsingles{worldsingles-test #:local{:root \"../worldsingles-test\"}}"))
{worldsingles-test #:local{:root "../worldsingles-test"}}
It appears to go wrong when the map has symbols:
user=> (n/sexpr (p/parse-string "#:foo{x 1}"))
{x 1}
So I’m looking at my handy reference https://clojure.atlassian.net/browse/CLJ-1910
> A keyword or symbol key without a namespace is read with the default namespace as its namespace.
In clj-kondo this is a small fix:
user=> (keys (n/sexpr (p/parse-string "#:foo{x 1}")))
(foo/x)
modified parser/clj_kondo/impl/rewrite_clj/node/seq.clj
@@ -56,9 +56,11 @@
m (first (node/sexprs children))
nspace (name nspace-k)]
(->> (for [[k v] m
- :let [k' (cond (not (keyword? k)) k
+ :let [k' (cond (not (ident? k)) k
(namespace k) k
- :else (keyword nspace (name k)))]]
+ :else (if (keyword? k)
+ (keyword nspace (name k))
+ (symbol nspace (name k))))]]
@seancorfield Pushed a fix for https://github.com/borkdude/clj-kondo/issues/1093 to master. Re-scheduled the release for coming weekend.
Nice! Thank you, sir!