Fork me on GitHub
#clj-kondo
<
2020-11-04
>
Charlie Briggs10:11:31

hey, I was wondering how I’d setup clj-kondo to not report unresolved-symbol for things extending clojure.test, e.g. thrown-with-data? here: https://clojureverse.org/t/testing-thrown-ex-info-exceptions/6146/3?

Charlie Briggs10:11:50

wonderful, thank you very much

paulbutcher11:11:26

I’m just getting started with clj-kondo, so please forgive me if I’m missing something obvious. In my test code, I tend to use :refer :all to drag in the namespace that I’m testing, which clj-kondo unsurprisingly warns about. I’ve worked out that I can disable this warning by putting {:linters {:refer-all {:exclude [my.namespace.here]}}} into my config.edn but that disables the warning everywhere. I only want to disable it within test code. Is there any way that I can achieve that?

practicalli-johnny15:11:11

If you are able to change the code, then use :refer [deftest is testing] instead of :refer :all which is more common approach to requiring vars.

borkdude12:11:22

@paulbutcher you can use namespace local config to achieve that

borkdude12:11:33

or an ignore hint

paulbutcher12:11:53

An ignore hint is inside the source code, yes? How do I create namespace local config?

paulbutcher12:11:01

Oh! Is it just a .clj-kondo directory inside the namespace?

borkdude12:11:10

(ns foo (:require #_:clj-kondo/ignore [foo.bar :refer :all]))
;; or
(ns foo {:clj-kondo/config {:linters {:refer-all {:level :off}}}}
    (:require [foo.bar :refer :all]))

borkdude12:11:24

so both in source

paulbutcher12:11:00

Thanks!

👍 3
benny19:11:50

@borkdude sorry to get back to the graal thingie, but clj-kondo can't get native image compiled with graalvm8-20.2

Error: Unsupported features in 5 methods
Detailed message:
Error: Frame states being merged are incompatible: unbalanced monitors - locked objects do not match
 This frame state: [locals: [1,2,3,1,_,_] stack: [7] locks: [] rethrowException]
Other frame state: [locals: [1,2,3,1,_,_] stack: [20] locks: [14 / 5] rethrowException]
Parser context: sci.impl.vars$alter_var_root.invokeStatic(vars.cljc:417) [bci: 11, intrinsic: false]
could the clj-kondo standalone.jar include your clj-reflector-java11 fix?

borkdude20:11:36

clj-kondo only supports compiling to native with graalvm jdk11 20.2.0

borkdude20:11:47

Ah I see, clj-kondo now includes sci and sci needs Clojure 1.10.2-alpha* to avoid those warnings in graalvm

borkdude20:11:14

@b Is there a reason you can't make the uberjar yourself, if you already have graalvm 11 in nixos?

benny20:11:12

just trying to cut down on the dependencies, because graal8 was based on the src release and that took 24 GB of memory to build which overwhelmed my computer and the build farm computer quite often

benny20:11:19

but yeah I could try to get leiningen and create the uberjar

borkdude20:11:54

That would be easier I think. You could maybe just run the existing script/compile in that case

benny20:11:58

I haven't yet checked if this is so easily done because NixOS is all about purity and if leiningen grabs a lot of dependencies then it requires network access which is impure

borkdude20:11:53

a PR to bring the uberjar build on circleci up to date with jdk11 + the reflector fix is also welcome

benny20:11:00

I will do that!

borkdude20:11:12

I think the sole reason it is published is the nixos builds, unless I forgot

benny20:11:06

and it's fine if the regular standalone.jar is replaced by the one that includes the java11-reflector-fix?

borkdude20:11:13

if it's only used by nixos, then I think so?

borkdude20:11:49

let's just do it. we'll change it if someone complains

benny20:11:49

I didn't know that history, I "just took over" in February because it was pretty much abandoned

benny20:11:01

I'll open a PR, thanks