I'm using kondo in a cljs/cljc project that uses clojure.test.check.random for generating https://github.com/dgtized/shimmers/blob/master/src/shimmers/math/deterministic_random.cljc#L1. However recently I started seeing line errors for unresolved var on make-random, split, and rand-double. When I look at the upstream library it does look like the implementations are not split in a cljc file but actually implemented as separate https://github.com/clojure/test.check/blob/master/src/main/clojure/clojure/test/check/random.cljs and https://github.com/clojure/test.check/blob/master/src/main/clojure/clojure/test/check/random.clj file implementations. I'm assuming that's why they are marked as unresolved vars but am curious what the correct way to reference these from a cljc file without triggering an unresolved var warning?
As context, I do use this library locally in both a cljs project and as a dependency for a clj project, so the code does work, I'm just curious why it's triggering a warning and how one is supposed to mark it correctly to resolve it in this case.
are you able to make a repro using a public github repo that I can clone locally with some instructions on how to reproduce the issue?
Yea the warning shows up when I run kondo on the https://github.com/dgtized/shimmers repo that the deterministic-random file is in and that's public, just check it out and run bin/lint on it and it triggers the warning.
$ clojure -M:clj-kondo --parallel --lint src test --repro
linting took 2701ms, errors: 0, warnings: 0I get this in a fresh clone.
when I init dependencies with:
clojure -M:clj-kondo --parallel --dependencies --copy-configs --lint "$(clojure -Spath)"
I get more:
$ clojure -M:clj-kondo --parallel --lint src test --repro
src/shimmers/algorithm/quadtree.cljc:149:3: warning: Missing protocol method(s): depth, height, width
src/shimmers/math/geometry.cljc:24:3: warning: Missing protocol method(s): point-at, random-point, sample-uniform, sample-with-resolution
src/shimmers/math/geometry/arc.cljc:41:3: warning: Missing protocol method(s): contains-entity?
src/shimmers/math/geometry/arc.cljc:47:3: warning: Missing protocol method(s): center
src/shimmers/math/geometry/arc.cljc:61:3: warning: Missing protocol method(s): sample-uniform, sample-with-resolution
src/shimmers/math/geometry/ellipse.cljc:38:3: warning: Missing protocol method(s): contains-entity?
src/shimmers/math/geometry/ellipse.cljc:76:3: warning: Missing protocol method(s): sample-uniform, sample-with-resolution
src/shimmers/math/geometry/ellipse.cljc:118:3: warning: Missing protocol method(s): signed-volume
src/shimmers/math/geometry/group.cljc:19:3: warning: Missing protocol method(s): depth
src/shimmers/math/geometry/group.cljc:37:3: warning: Missing protocol method(s): scale-size
src/shimmers/math/geometry/line.cljc:19:3: warning: Missing protocol method(s): heading-xz, heading-yz, slope-xz, slope-yz
src/shimmers/sketches/minimum_spanning_tree.cljs:49:47: error: Expected: natural integer, received: double.
src/shimmers/sketches/space_colonization.cljs:75:21: error: Expected: natural integer, received: double.
src/shimmers/sketches/superposition.cljs:29:3: warning: Missing protocol method(s): random-point, random-point-inside, sample-uniform, sample-with-resolution
linting took 2717ms, errors: 2, warnings: 12but I can't repro your issues
$ bin/lint
src/shimmers/math/deterministic_random.cljc:15:28: warning: Unresolved var: tcr/make-random
src/shimmers/math/deterministic_random.cljc:24:18: warning: Unresolved var: tcr/split
src/shimmers/math/deterministic_random.cljc:26:6: warning: Unresolved var: tcr/rand-double
linting took 6298ms, errors: 0, warnings: 3
$ clojure -M:clj-kondo --parallel --lint src test --repro
src/shimmers/math/deterministic_random.cljc:15:28: warning: Unresolved var: tcr/make-random
src/shimmers/math/deterministic_random.cljc:24:18: warning: Unresolved var: tcr/split
src/shimmers/math/deterministic_random.cljc:26:6: warning: Unresolved var: tcr/rand-double
linting took 6411ms, errors: 0, warnings: 3Is there a cache somewhere I can clean maybe?
yes, .clj-kondo/.cache you can clean
I'll try the project in my editor with lsp to see if I can get it to repro
huh, well after cleaning the cache it's not reporting the unused var anymore, so I guess that fixes my problem. Curious that you are seeing those warnings though, as I'm not seeing those. Thank you very much!
no I can't
it's not "unused var", but "unresolved var"
Sorry, yes unresolved var, that was just a typo on my part.
Very much appreciate you taking the time to check it out personally, sorry it was just a cache issue, next time I will try that first before asking!
no worries. there could be a bug somewhere in clj-kondo that's just hard to repro, but glad it's working now