Is there a good way to get a repl with all of the namespaces in my :requires
key processed? (also the default commands)
@duck Is this for #babashka? :)
oops, it was
Why, If I have .clj-kondo/config.edn
all warnings and errors disappears in IDE (Emacs, Cursive)? If I delete .clj-kondo/config.edn
then all warnings returns in IDE.
contents of .clj-kondo/config.edn
{:output {:exclude-files [""]}
:linters {:consistent-alias
{:aliases {clojure.string string}}
:unresolved-namespace
{:exclude [user criterium.core]}
:unresolved-symbol
{:exclude [(cljs.test/are [thrown? thrown-with-msg?])
(cljs.test/is [thrown? thrown-with-msg?])
(clojure.test/are [thrown? thrown-with-msg?])
(clojure.test/is [thrown? thrown-with-msg?])]}
:unsorted-required-namespaces
{:level :warning}
:unused-referred-var
{:exclude {clojure.test [is deftest testing use-fixtures]}}}
:skip-comments true}
I suspect this is the culprit: :output {:exclude-files [""]}
the empty filename always matches any file probably
it's a regex
thanks! if I put {:exclude-files ["target"]}
all warnings became visible!
I’ve got a clojure.test file that is using (:require [foo.core :refer :all])
in the namespace declaration. All the symbols that should be referred by that are being flagged later on as error: Unresolved symbol: bar
. Is that expected or a bug? If I use :refer [bar]
, it is not flagged. This is with the latest version of clj-kondo installed on latest MacOS Big Sur via Homebrew.
@droberts3 Did you not have that with the previous version of clj-kondo?
I don’t know. I haven’t gone back and installed a previous version to figure it out. I wanted to ask here before I tried to debug it too much further. I was thinking that maybe clj-kondo didn’t pull in required namespaces on purpose (performance?) and was just using the static symbols in a :refer
form in the file itself.
It’s pretty common in unit tests to use :refer :all
to pull in everything in the namespace under test.
@droberts3 It's a bit of a gray area. Since clj-kondo is a static analyzer and pretty much just lints what you throw at it, without inspecting other stuff on your filesystem, this can be hard. But chances are that when you also have linted foo.core
while also having a .clj-kondo
dir so it can save information there, that this will work correctly
I think that should work even. So can you maybe do:
mkdir -p .clj-kondo
clj-kondo --lint src:test --dependencies
and then check again in your editor after making an edit?(the --dependencies
flag is telling clj-kondo to not emit any output because you are linting only for populating the cache)
Ah. Let me try this. I don’t have a .clj-kondo
directory as I have just been using straight defaults.
Yep, that worked
Thanks!