Fork me on GitHub
#clj-kondo
<
2020-02-10
>
Sasho14:02:21

👋 Hello. Does anyone know where I can find a full list of all the linters, that clj-kondo has?

Sasho14:02:05

Thank you, this is exactly what I needed. The idea is that I want to disable some warnings, but I need the exact name of the linter in order to add it to the config.

borkdude14:02:47

:thumbsup: One other way to discover the right keys with each warning is to use JSON or EDN output

Sasho14:02:22

But I don’t invoke clj-kondo manually, I use it via calva and I see the warnings in the Problems tab of Visual Studio Code.

borkdude14:02:55

Just out of curiosity, which linters do you disable?

Sasho14:02:47

Unresolved namespace clojure.pprint. Are you missing a require?

Sasho14:02:12

Also use seq instead of (not (empty? ,,,)

borkdude14:02:16

Is that a false positive or did you really forget a require?

borkdude14:02:02

In case of false positives, I'd like to receive issues for them, to improve clj-kondo

Sasho14:02:03

O.K., so I’m new to clojure and I don’t know what the best practice for this is, but why do I need to require something, when I can reference it with full namespace?

borkdude14:02:20

Because the namespace might not have been loaded yet.

Sasho14:02:36

Meaning it will give me a runtime error?

borkdude14:02:12

Yes. Most tooling will load clojure.pprint already but you can not rely on that implicitly. $ clojure -e "(clojure.pprint/pprint {})" Execution error (ClassNotFoundException) at http://java.net.URLClassLoader/findClass (URLClassLoader.java:471). clojure.pprint

borkdude14:02:07

In doubt, ask Alex Miller about this, he will tell you the same 😉

Sasho14:02:31

O.K., a couple of noob questions. clojure.pprint -> this is not part of clojure.core, obviously, right?

borkdude14:02:59

it is part of the standard library of clojure but not everything in the standard library is pre-loaded

borkdude14:02:12

and you should never rely on anything but clojure.core to be already loaded

borkdude14:02:40

(clojure.core, the namespace, clojure.pprint is a different namespace)

Sasho14:02:43

Aha, ok, so when I start a clojure program, is automatically pre-loads clojure.core , but nothing else (unless I require it explicitly, of course).

borkdude14:02:18

yes, or unless any other of your REPL tooling is loading that, but again, you should not trust on that, because if you release an uberjar for example, this tooling won't be there anymore

Sasho14:02:37

O.K., in that case, instead of disabling the linter, I might as well fix the offences 😉

Sasho14:02:46

Thank you for taking the time to explain this to me. 🙂

borkdude14:02:34

No problem. It's always worth digging a little deeper to see why people are doing stuff.

borkdude14:02:09

This should probably be documented... 🙂

Sasho14:02:22

The source is ok for this particular case, although something like https://docs.rubocop.org/en/stable/ would be nice. 🙂