Fork me on GitHub

I deleted borkdude/babashka and borkdude/clj-kondo on Dockerhub now. Let's see how many questions I will get and how many CIs will break... tl;dr: use babashka/babashka and cljkondo/clj-kondo


☝️ it broke the GH actions in our repo :) BTW thanks for this awesome tool!

👍 3

There we have the first one @thiagokokada :)


That was fast 😆

Felipe Marques20:05:51

Hi, everyone, I'm getting a weird error on clj-kondo for a file:

test/integration/enrollment_view/primary_inclusion_flow.clj:1:1: error: Unresolved symbol:
After running:
clj-kondo --cache false --lint test/integration/enrollment_view/primary_inclusion_flow.clj
I even changed the content of the file to a file that is not failing, but I keep keeting this error. Did anyone have a similar problem?

Felipe Marques20:05:45

It was the UTF-8 BOM character 😅 Solved by changing the encoding.

Felipe Marques20:05:56

Nervermind! 😅

Joshua Suskalo21:05:09

Is there any way for me to configure the :use linter to not complain about a particular ns? In this case, we like including all the specter vars with refer-all, but if we manually use (:require [com.rpl.specter :refer :all]) it says unresolved symbol on all the uses


@suskeyhose these unresolved symbols should go away when linting the used namespace as well


if specter uses standard clojure to define those var and not some defcustom macro

Joshua Suskalo21:05:43

Ah, I see. Then I wonder why it has unresolved symbol if we put the ns in the require block but not in the use block.


it is all defnav


can you explain what you mean by the latter?


you can solve that using :lint-as


if we put it in (:use [com.rpl.specter]) then there are no complaints about unresolved symbols from specter


but with (:require [com.rpl.specter :refer :all]) kondo cannot resolve the symbols from specter


ah I see what the problem is. when using :refer :all clj-kondo will go out to the cache and see if this info is already there, to give more accurate linting


but if specter using defnav then clj-kondo hasn't saved these vars to the cache


and so you will get less precise linting


got it, that makes sense

Joshua Suskalo21:05:38

I tried using lint-as and it didn't appear to fix it, but maybe I need to do something to run it without the cache


@suskeyhose you need to re-lint specter after the config change

Joshua Suskalo21:05:24

So that'd just be by running

clj-kondo --dependencies --lint "$(clojure -Spath)"


correct. use --parallel too for higher speed


if specter would package a clj-kondo config in the jar, then you would also get a copy of that in your .clj-kondo and this way of linting would tell you how to activate that


Perhaps you could suggest this to the specter author, if you find a config that works well:


so did it work out now @suskeyhose?

Joshua Suskalo21:05:34

No, and I'm not quite sure why. I set it to lint the defnav calls as defn, (like this, but it's still unable to resolve those symbols.


did it say something about skipping already linted jars?

Joshua Suskalo21:05:05

I was able to validate that it refreshed the cache because some of the symbols it hadn't recognized before it did recognize this time.

Joshua Suskalo21:05:14

just not the defnav ones


can you post your config? also to be sure, just rm -rf .clj-kondo/.cache and try again

Joshua Suskalo21:05:51

I'll try removing the cache and retrying. The whole config is just

{:lint-as {com.rpl.specter/defnav clojure.core/defn}}

Joshua Suskalo21:05:05

This is the first time we've used a linter on this project, trying to adopt it.


clj-kondo just has a hard time with :refer :all and custom def macros


it also suggest trying not to use :refer :all (for this reason, but also for other reasons, just as a general style recommendation)

Joshua Suskalo21:05:03

oh boy, now it doesn't work in the use block either 😂

Joshua Suskalo21:05:50

Yeah, this is just unfortunate. In any case I'd still be curious if we could customize the :use linter to not complain for particular namespaces.


we avoid :refer :all like the plague, with the one exception of specter


because that's a lot of short & common symbols that we do not want to prefix with s/


it would be good to have a repro of this, because I think it should work

Joshua Suskalo21:05:59

I'll see if I can make a tiny thing that reproduces the error.


I will take a look tomorrow and will call it a day, it's getting close to midnight here.

Joshua Suskalo21:05:52

Oh that's funny, it thinks it's C++

Joshua Suskalo21:05:33

I forgot to remove the .cpcache, but whatever


@suskeyhose I think I see the issue. The defnav macro, in .clj at least, is a locally defined using another macro. In cljs it works differently.


so it probably needs another lint-as for this


defmacroalias defnav macros/defnav

Joshua Suskalo21:05:58

Right, but if I have it lint-as defn, wouldn't that remove the issue? It seems odd that I'd have to change how defmacroalias is linted too


yep, that's it:

{:lint-as {com.rpl.specter/defnav clojure.core/defn
           com.rpl.specter/defmacroalias clojure.core/def}}
this works

Joshua Suskalo21:05:37

Okay, cool. Well I'll go for that. Thanks!


Feel free to contribute the config here: once you have it all working


Excellent! I have a feeling that a lot of specter users do refer all the symbols... contributing this kondo config to specter might make sense

Joshua Suskalo22:05:44

Sounds good, I'll look at making a PR in specter