Fork me on GitHub
#polylith
<
2023-11-19
>
martinklepsch12:11:56

Hey again 🙂 I'm dabbling around a bit more and noticed that clj-kondo does not seem to lint correctly without further instructions, e.g. a function that doesn't exist is not flagged by it. I tried a few different approaches, mostly along the lines of this:

clj-kondo --lint bases/http/resources:bases/http/src:bases/http/test:components/database/resources:components/database/src:components/database/test:components/logger/resources:components/logger/src:components/logger/test:development/src
But not seeing any errors despite referencing an undefined var. Do you have any additional guidance on making use of clj-kondo in a polylith workspace?

hiredman15:11:27

You are likely not passing things correctly, kondo will definitely complain about undefined stuff just fine

hiredman15:11:20

It has been a while at work since I looked at what we are doing, but I believe the polylith docs suggest having a dev alias that includes everything for running repls at dev time, and I believe that is also what we use for running kondo

martinklepsch21:11:11

Yeah, that's pretty much what I tried, use the classpath as defined by the :dev alias and pass that to kondo.

jasonjckn03:11:55

i'm a kondo user here, the only change I had to make to my config.edn, was to add

:ignore [
          :redefined-var 
          ]
because components interface.clj will redefine.

jasonjckn04:11:09

Sort of tangential , but you can also use clojure-lsp to get kondo diagnostics and a bit more (its a superset, iirc).

/opt/homebrew/bin/clojure-lsp diagnostics 

jasonjckn04:11:58

I don't think there's any special configuration required for this, but just in case here's my LSP config, .lsp/config.edn

{:source-aliases              #{:dev :test :build :+repl}
 :keep-parens-when-threading? true
 :copy-kondo-configs?         true
 :semantic-tokens?            false
 :completion                  {:analysis-type :slow-but-accurate}
 :java                        {:download-jdk-source? true}
 :stubs                       {:generation {:namespaces #{"datomic.api"}}}}

jasonjckn04:11:03

that'll compute the classpath for you.

martinklepsch15:11:18

Odd 🙂 I'll keep digging a bit more, and maybe I'll try your lsp config, wanted to give that a go for a while anways 🙂