Fork me on GitHub
#clj-kondo
<
2019-06-12
>
tatut12:06:49

are you running kondo as a CI step to check style?

tatut12:06:47

Is there some ready support or should I just use the API in a clojure.test to ensure no warnings are given?

borkdude13:06:31

@tatut there are already people using kondo in CI. apart from using a JVM, you can also call the binary and check the exit codes in a script for example

borkdude13:06:57

you can also use JSON output and feed it to jq to script whatever you want, without using a JVM

tatut13:06:43

running in JVM is easier as I don’t have to install anything on the CI machine

tatut13:06:46

(deftest lint
  (let [result (clj-kondo/run! {:lint ["src/clj" "src/cljs" "src/cljc"]})
        {:keys [error warning]} (:summary result)
        ok? (= 0 error warning)]
    (is ok? "No lint warnings")
    (when-not ok?
      (clj-kondo/print! result))))

tatut13:06:58

that simple test seems to do the trick

borkdude13:06:09

that should work yes

tatut13:06:52

now I just have to fix all warnings 😅 …that’s the bigger issue in this large project

borkdude13:06:04

or just ignore the warnings and only count the errors. up to you 🙂

borkdude13:06:10

you can also disable certain linters for the time being

borkdude13:06:16

using the :config parameter

tatut13:06:27

I may do an expected count and check that

tatut14:06:30

ok, seems just checking errors at first would be a good first step

tatut14:06:05

weird, I’m getting a parse error “no conversion to symbol” in one file, but it doesn’t seem to contain anything out of the ordinary… looks like it’s coming from the reader, not kondo though

tatut14:06:37

looks like a namespaced map problem, if I have #:some.ns {:key "foo"} map in a cljs file, the parsing fails

tatut14:06:43

writing it as {:some.ns/key "foo"} works

borkdude14:06:57

@tatut can you create a small repro foo.clj so when calling clj-kondo --lint foo.clj you get this problem?

borkdude14:06:32

putting only that expression in file does not reproduce it

tatut14:06:28

it doesn’t seem to occur in the command line tool, only when running from my project jvm… perhaps I’m getting some wrong version from my other deps

borkdude14:06:22

hm, is another library of yours also using clj-kondo? I made a patch, for this in rewrite-clj but I’m not calling that patch in the JVM version

tatut14:06:12

I don’t think so, but I’ll check my deps

borkdude14:06:02

requiring clj-kondo.impl.rewrite-clj-patch before calling clj-kondo should resolve the issue

tatut14:06:15

that works

borkdude14:06:25

I think I should move that require from clj-kondo.main to clj-kondo.core, but it might interfere if people already use rewrite-clj in their projects

borkdude15:06:32

I think eastwood had the same trouble with dependency clashes when people used that in their JVM so they inlined all the deps. Maybe I should do that with rewrite-clj, but I don’t know how that works license-wise

dominicm17:06:59

@tatut I'm using it with reviewdog