Fork me on GitHub
#clj-kondo
<
2020-03-23
>
eval-on-point13:03:23

does the master branch currently pass all tests? it is failing on 2 tests and throwing 1 error on my machine

borkdude13:03:23

@mitchell_clojure Yes. What tests are failing for you?

borkdude13:03:13

Try script/test. This will populate your .m2 cache with certain dependencies that are linted in the tests.

borkdude13:03:25

# populate mvn cache for extract tests
clojure -Sdeps '{:deps {org.clojure/clojure {:mvn/version "1.9.0"}}}' -Spath > /dev/null
clojure -Sdeps '{:deps {org.clojure/clojure {:mvn/version "1.10.1"}}}' -Spath > /dev/null
clojure -Sdeps '{:deps {org.clojure/clojurescript {:mvn/version "1.10.520"}}}' -Spath > /dev/null

eval-on-point13:03:04

ERROR in (run!-test) (core.clj:4789)
file arguments jar file as string or file
expected: (= findings (:findings (clj-kondo/run! {:lint [(io/file (System/getProperty "user.home") ".m2" "repository" "org" "clojure" "spec.alpha" "0.2.187" "spec.a
lpha-0.2.187.jar")]})))                                                                                                                                            
  actual: java.lang.ClassCastException: class .File cannot be cast to class java.lang.CharSequence (.File and java.lang.CharSequence are in module jav
a.base of loader 'bootstrap')                                                                                                                                      
 at clojure.core$re_matcher.invokeStatic (core.clj:4789)
    clojure.core$re_find.invokeStatic (core.clj:4838)
    clojure.core$re_find.invoke (core.clj:4838)
    clj_kondo.impl.core$filter_findings$iter__8301__8305$fn__8306$fn__8307$fn__8310.invoke (core.clj:291)
.
.
.

FAIL in (extract-clojure-core-vars-test) (extract_var_info_test.clj:12)
expected: (contains? vars (quote future))
  actual: (not (contains? #{} future))

FAIL in (extract-clojure-core-vars-test) (extract_var_info_test.clj:13)
expected: (contains? vars (quote transduce))
  actual: (not (contains? #{} transduce))

eval-on-point13:03:29

let me double check my environment

borkdude13:03:38

to be sure, run lein clean

borkdude13:03:10

how are you running your tests from the command line?

borkdude13:03:17

and which OS?

eval-on-point13:03:08

running on linux, openjdk 11

eval-on-point13:03:37

with lein clean then ./script/test

borkdude13:03:11

let me try that on macOS

borkdude14:03:43

just to make sure, you are on master? and your HEAD = 45c615fc969ab616303283faf3d3c744b6e71ba2?

borkdude14:03:30

all tests passing here, both with clojure and lein

eval-on-point14:03:31

yeah, on the bump version commit

borkdude14:03:53

can you do a clean checkout of the repo, just to make sure? delete the previous one

borkdude14:03:05

I can't repro your problem

eval-on-point14:03:55

yeah sure, I'll have to work on it some more tonight, but I'll update you on if it is an issue that could be accounted for on the public docs or not

eval-on-point14:03:13

to add some context, though, I think it may be something up with my dev environment because Cider has had trouble with namespace resolution for some classes like namespaced-map-node

borkdude14:03:44

maybe try only running the tests with clojure to exclude any lein profiles issues?

borkdude14:03:45

clojure -A:test

eval-on-point14:03:29

yeah I still get the errors on a completely clean copy of the repo

eval-on-point14:03:39

have to do work now but I will follow up on this

ullrich19:03:32

Hi, We’re using plenty of goog.global in our codebase and I’m trying to get it ignored by clj-kondo. I thought I’d use :unresolved-symbol for that but I’m getting a java.lang.IllegalArgumentException: no conversion to symbol. Here’s an example with version v2020.02.28 clj-kondo --config '{:linters {:unresolved-symbol {:exclude [(goog.global)]}}}' --lint - <<< "(def global goog.global)" Anything obvious I’m doing wrong here? Also is :unresolved-symbol the way to go for goog.global or is there a way that I could use to actually get it working? Thanks 🙇

borkdude19:03:28

@ullrich.schaefer if goog.global is not a function, don't wrap it in parens:

$ clj-kondo --config '{:linters {:unresolved-symbol {:exclude [goog.global]}}}' --lint - <<< "(def global goog.global)"
linting took 7ms, errors: 0, warnings: 0

ullrich19:03:23

Zoom. Thanks for the quick answer 🙏 Just work 🙂

borkdude19:03:31

is goog.global something that is always defined in CLJS? then I think clj-kondo should just ignore it for CLJS

borkdude19:03:51

I'll make an issue for that.

👍 4
ullrich19:03:57

I believe goog.global is always defined. But I might be missing something obvious (again 😉).

ullrich14:03:31

I’ve got a followup question to this. Until #816 has been addressed we ant to use {:linters {:unresolved-symbol {:exclude [...]}}} config. Is there a way to specify that this exclusion only applies to CLJ or CLJS?

borkdude14:03:17

no, it's global for both langs

borkdude14:03:49

but like I said, you can also do:

(def x js/goog.global)

👍 4
borkdude14:03:04

and this will give a warning in CLJ

borkdude14:03:57

unless goog.global is renamed by advanced compilation, caveat!

4
💡 4
borkdude14:03:34

you can also use reader conditionals to ensure you use the symbol only from CLJS

borkdude14:03:43

those are all the options I can think of

4
ullrich14:03:30

Thanks for the input

ullrich19:03:59

Thanks @borkdude Great work on clj-kondo ! It sparks joy every time ❤️

borkdude19:03:43

ah, it seems (def x js/goog.global) also works (instead of a config). Glad you enjoy it.