clj-kondo

https://github.com/clj-kondo/clj-kondo
slipset 2021-06-04T09:53:54.177600Z

Could this be linted?

(defprotocol Bar
  (bar [_ x]))

(defrecord foo [x]
  Bar)

(bar (->foo 1) 1) ;; explodes
So basically a warn (or error) on missing implementation of protocol-fn?

borkdude 2021-06-04T10:06:31.177900Z

I think it could

Karol Wójcik 2021-06-04T13:14:20.179300Z

I think I found a false positive with clj-kondo. something.cljc

(let [lname "hello-world"
      gfullname #?(:bb nil
                   :clj (symbol (str (ns-name *ns*) "." lname)))
      gclass #?(:bb nil
                :clj (println gfullname)
                :cljs nil)])
❯ clj-kondo --lint something.cljc     
something.cljc:1:6: error: let binding vector requires even number of forms
something.cljc:1:7: warning: unused binding lname
something.cljc:2:7: warning: unused binding gfullname
something.cljc:4:7: warning: unused binding gclass
something.cljc:4:7: error: Unresolved symbol: gclass
something.cljc:6:23: error: unsupported binding form nil
linting took 35ms, errors: 3, warnings: 3
Can someone reproduce it as well? clj-kondo v2021.05.31

dominicm 2021-06-05T20:45:13.195200Z

Btw, you can use :default to target (not :clojure): #?(:clj (symbol …) :default nil)

borkdude 2021-06-04T13:18:07.179500Z

have you tried to run it? ;)

borkdude 2021-06-04T13:18:24.179800Z

especially in CLJS it should not work

borkdude 2021-06-04T13:18:51.180Z

cljs.user=> (load-file "/tmp/something.cljc")
Unexpected error (ExceptionInfo) macroexpanding cljs.core$macros/let at (<cljs repl>:1:1).
let requires an even number of forms in binding vector

Karol Wójcik 2021-06-04T13:20:35.180200Z

Oh 😂 My bad! I have tried java/bb 😄

borkdude 2021-06-04T13:21:15.180700Z

do you want to run this file in CLJS as well btw?

Karol Wójcik 2021-06-04T13:21:37.180900Z

In some time probably yes

borkdude 2021-06-04T13:22:30.181700Z

ok

borkdude 2021-06-04T14:18:47.181900Z

@slipset feel free to create an issue

slipset 2021-06-04T14:47:46.182500Z

Will do!