Fork me on GitHub
#clj-kondo
<
2023-01-16
>
grahamcarlyle09:01:22

the new :aliased-namespace-var-usage is complaining when the as-alias is just used to refer to namespaced keywords in my project. I thought :as-alias was designed for that sort of usage?

borkdude09:01:24

@U053YSSSJ Hmm, can you give a repro?

borkdude09:01:25

Hmm, I see:

$ clj-kondo --lint - <<< '(ns foo (:require [bar :as-alias b])) ::b/dude'
<stdin>::: warning: Namespace only aliased but wasn't loaded: bar
linting took 35ms, errors: 0, warnings: 1
Yeah, that's no good. I'll fix it right away

grahamcarlyle09:01:32

thanks, a nice demo of how to quickly reproduce too 🙂

borkdude09:01:15

Fixed on master

👍 4
borkdude09:01:56

@UKFSJSM38 Please bump clj-kondo with this fix in clojure-lsp

ericdallo11:01:59

Sure, I can bump to latest kondo before next release

borkdude20:01:29

This should be fixed in 2023.01.16 which I just released

👍 4
Colin P. Hill14:01:45

Is there currently any way to configure :missing-docstring to ignore vars with :no-doc/`:skip-wiki`/etc?

borkdude14:01:55

No, but I think that would be a great addition. Could you post an issue? (+ optionally a PR, don't feel pressured)

👍 2
borkdude20:01:49

https://github.com/clj-kondo/clj-kondo: static analyzer and linter for Clojure code that sparks joy 2023.01.16 • https://github.com/clj-kondo/clj-kondo/issues/1920: new linter :def-fn: warn when using fn inside def, or fn inside let inside def (https://github.com/andreyorst). • https://github.com/clj-kondo/clj-kondo/issues/1949: :aliased-namespace-var-usage gives erroneous output for keywords • Add test for https://github.com/clj-kondo/clj-kondo/issues/1944 (already worked) • Don't reload SCI namespace on every hook usage

borkdude20:01:10

@UKFSJSM38 plz upgrade in clojure-lsp - especially the hook reloading should matter for performance if many hooks are used

borkdude20:01:25

accidentally the hook code was reloaded every time the hook was used...

borkdude20:01:37

I recommend upgrading to 2023.01.16 if you're using many hooks since accidentally the SCI namespaces were always reloaded on every hook usage. Due to this: https://github.com/clj-kondo/clj-kondo/issues/1954

souenzzo20:01:18

Seems that kondo do not support the deprecation of a one specific arity. Anyone else interested in it? echo '(defn foo ^:deprecated (^:deprecated []) ([x] x)) (foo)' | clj-kondo --lint -

dpsutton20:01:38

I don’t think that’s a thing for Clojure either:

user=> (defn foo ^:deprecated (^:deprecated []) ([x] x))
#'user/foo
user=> (meta #'foo)
{:arglists ([] [x]),
 :line 140,
 :column 1,
 :file "NO_SOURCE_PATH",
 :name foo,
 :ns #object[clojure.lang.Namespace "0x7a3eafcd" "user"]}

😢 2
dpsutton20:01:17

note if you put the ^:deprecated on the var

user=> (defn ^:deprecated foo (^:deprecated []) ([x] x))
#'user/foo
user=> (meta #'foo)
{:deprecated true,
 :arglists ([] [x]),
 :line 142,
 :column 1,
 :file "NO_SOURCE_PATH",
 :name foo,
 :ns #object[clojure.lang.Namespace "0x7a3eafcd" "user"]}

souenzzo20:01:10

Actually:

user=>  (defn foo (^:deprecated []) ([x] x))
#'user/foo
user=> (map meta (:arglists (meta #'foo)))
({:deprecated true} nil)