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!
There we have the first one @thiagokokada :)
That was fast 😆
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?It was the UTF-8 BOM character 😅 Solved by changing the encoding.
Nervermind! 😅
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
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?
in specter
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
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
So that'd just be by running
clj-kondo --dependencies --lint "$(clojure -Spath)"
right?correct. use --parallel
too for higher speed
okay, cool
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: https://github.com/clj-kondo/clj-kondo/blob/master/doc/config.md#exporting-and-importing-configuration
so did it work out now @suskeyhose?
No, and I'm not quite sure why. I set it to lint the defnav calls as defn, (like this https://github.com/redplanetlabs/specter/blob/master/src/clj/com/rpl/specter.cljc#L715-L723), but it's still unable to resolve those symbols.
did it say something about skipping already linted jars?
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.
just not the defnav ones
can you post your config? also to be sure, just rm -rf .clj-kondo/.cache
and try again
I'll try removing the cache and retrying. The whole config is just
{:lint-as {com.rpl.specter/defnav clojure.core/defn}}
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)
oh boy, now it doesn't work in the use block either 😂
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
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.
many thanks @borkdude
Oh that's funny, it thinks it's C++
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
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 worksOkay, cool. Well I'll go for that. Thanks!
Feel free to contribute the config here: https://github.com/clj-kondo/config once you have it all working
Or perhaps in the specter repo itself: https://github.com/clj-kondo/clj-kondo/blob/master/doc/config.md#exporting-and-importing-configuration
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
Sounds good, I'll look at making a PR in specter