This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-07-09
Channels
- # announcements (1)
- # aws (4)
- # beginners (55)
- # calva (13)
- # cider (58)
- # clj-kondo (59)
- # cljs-dev (4)
- # clojure (21)
- # clojure-austin (1)
- # clojure-dev (2)
- # clojure-europe (4)
- # clojure-italy (9)
- # clojure-nl (13)
- # clojure-norway (4)
- # clojure-spec (12)
- # clojure-uk (15)
- # clojurescript (22)
- # cursive (11)
- # datomic (3)
- # duct (1)
- # events (1)
- # fulcro (6)
- # graalvm (28)
- # hoplon (9)
- # jobs (2)
- # jobs-discuss (21)
- # mount (14)
- # nrepl (4)
- # off-topic (38)
- # pathom (1)
- # perun (4)
- # re-frame (17)
- # reitit (32)
- # shadow-cljs (44)
- # testing (7)
- # tools-deps (62)
- # vim (10)
@lee I think you’re the first clj-kondo user that uses :default, it’s currently not recognized. I’ll make a fix, thanks
here is a fix for linux: https://4381-176829714-gh.circle-artifacts.com/0/release/clj-kondo-2019.07.06-alpha-SNAPSHOT-linux-amd64.zip and here is one for macOS: https://4379-176829714-gh.circle-artifacts.com/0/release/clj-kondo-2019.07.06-alpha-SNAPSHOT-macos-amd64.zip
I got that :default idea from our very own @sogaiu. I am not handling clojure-clr yet, but it is a step in that direction.
BTW your clj-kondo logo is pretty awesome. It tells the story and spirit of the tool in smile inducing way.
or maybe I recommended it to someone else, but I vaguely remember this for the same reason as sogaiu mentions: if more targets are added, you're already future proof
rewrite-clj has maybe uncovered another clj-kondo issue. In a macro, a variable only referenced with quote unquote is reported as unused. For example, clj-kondo gives an unused binding warning for new-meta
for the following:
(defmacro import-fn
"Given a function in another namespace, defines a function with the
same name in the current namespace. Argument lists, doc-strings,
and original line-numbers are preserved."
[src-sym target-name target-meta]
(let [vr (resolve-sym src-sym)
m (meta vr)
m (resolve-fn-location m)
new-meta (dissoc target-meta :name)
protocol (:protocol m)]
(when (:macro m)
(throw (ex-info "potemkin clj cannot import-fn on a macro" {:symbol src-sym})))
`(do
(def ~(with-meta target-name (if protocol {:protocol protocol} {})) (deref ~vr))
(alter-meta! (var ~target-name) merge '~new-meta)
~vr)))
right now clj-kondo doesn't analyze everything that follows a literal quote for usages, but in backticks this apparently doesn't hold
I have another one for you. When including a macro like so in a cljc source:
(ns forborkdude
#?(:cljs (:require-macros [forborkdude :refer [my-macro]])))
#?(:clj
(defmacro my-macro[x]
`(str "hello there, " ~x)))
(my-macro "borkdude")
clj-kondo reports my-macro
as an unresolved symbol.self-hosted CLJS is on my todo list… still need to learn details on how macros work there.
for self-hosted you'll need to remove the :clj
conditional and then it should just work, unless you're using JVM specific things
@lee here's a fix for the self-require issue: https://4388-176829714-gh.circle-artifacts.com/0/release/clj-kondo-2019.07.06-alpha-SNAPSHOT-macos-amd64.zip
rewrite-clj tests make heavy use of the clojure.test.are
macro. Does clj-kondo want to do any linting on these? Contrived silly example:
(deftest t-for-borkdude
(are [?a ?b]
(is (= ?a (dec ?b)))
1 2
10 11
14 15))
Currently clj-kondo informs me that ?a
and ?b
are unresolved symbols.Oh wait, your default config has some handling for are: https://github.com/borkdude/clj-kondo/blob/67966d2c38a813c909371f5c08b64a742c6806e4/src/clj_kondo/impl/config.clj#L44
If I add the following to my .clj-kondo/config.edn
my cljc files no longer produce warnings:
{:linters
{:unresolved-symbol
{:exclude [(cljs.test/are)
(cljs.test/is [thrown-with-msg?])]}}}
I frankly don’t much about them yet, but rewrite-clj uses defspec
in some tests. I don’t think clj-kondo handles these puppies yet?
Updated docs for the snap package manager. You might want to try it: https://github.com/borkdude/clj-kondo/blob/master/doc/install.md#snap-linux (cc @jr0cket)