clj-kondo

https://github.com/clj-kondo/clj-kondo
Charlie Briggs 2020-11-04T10:04:31.312700Z

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 Briggs 2020-11-04T10:05:50.313600Z

wonderful, thank you very much

paulbutcher 2020-11-04T11:55:26.316700Z

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-john 2020-11-05T15:17:11.358900Z

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.

borkdude 2020-11-04T12:03:22.317Z

@paulbutcher you can use namespace local config to achieve that

borkdude 2020-11-04T12:03:33.317200Z

or an ignore hint

paulbutcher 2020-11-04T12:03:53.317700Z

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

paulbutcher 2020-11-04T12:05:01.318800Z

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

borkdude 2020-11-04T12:06:10.319Z

(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]))

borkdude 2020-11-04T12:06:24.319200Z

so both in source

paulbutcher 2020-11-04T12:07:19.319500Z

Ah! Got you.

paulbutcher 2020-11-04T12:08:00.320200Z

Thanks!

👍 1
benny 2020-11-04T19:56:50.323300Z

@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?

borkdude 2020-11-04T20:02:36.324Z

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

borkdude 2020-11-04T20:04:47.325400Z

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

borkdude 2020-11-04T20:05:14.326Z

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

benny 2020-11-04T20:06:12.326900Z

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

benny 2020-11-04T20:07:19.327700Z

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

borkdude 2020-11-04T20:07:54.328300Z

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

benny 2020-11-04T20:09:58.329300Z

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

borkdude 2020-11-04T20:10:53.329800Z

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

benny 2020-11-04T20:11:00.330100Z

I will do that!

borkdude 2020-11-04T20:11:12.330500Z

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

benny 2020-11-04T20:12:06.331100Z

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

borkdude 2020-11-04T20:13:13.331400Z

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

borkdude 2020-11-04T20:13:49.332200Z

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

benny 2020-11-04T20:13:49.332300Z

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

benny 2020-11-04T20:14:01.332800Z

I'll open a PR, thanks