Fork me on GitHub
#clj-kondo
<
2019-11-06
>
borkdude10:11:25

clj-kondo was featured on the CLJS podcast: https://clojurescriptpodcast.com/

eraserhd14:11:23

Hey, I just installed clj-kondo, and it is really nice! So, thanks! I use a rando editor (Kakoune), and it was about three lines of config.

eraserhd14:11:41

Part of me appreciating it is this mode of editor integration, which I shall call "Just a Program".

borkdude14:11:40

sounds good! PR welcome here if you want to add editor integration documentation: https://github.com/borkdude/clj-kondo/blob/master/doc/editor-integration.md

eraserhd14:11:32

I have made myself a note to do so.

borkdude18:11:14

has anyone used clj-kondo on macOS catalina?

delaguardo19:11:14

Happily using it since early beta)

delaguardo19:11:39

Beta of Catalina of course

borkdude19:11:53

did you have to set some security flags to use the clj-kondo binary?

borkdude19:11:15

there's a discussion about this going on in #graalvm

viesti19:11:27

didn't need flagging myself

eraserhd20:11:32

wrt #515 (warn about missing require when using a known namespace), what exactly prevents warning about aliases?

eraserhd20:11:20

it's not a fundamental problem, right?

borkdude20:11:33

@eraserhd can you give an explicit example?

borkdude20:11:16

I don't understand what you mean with "warning about aliases"

eraserhd20:11:36

if I type str/replace, for example, but don't have a str alias in my ns.

borkdude20:11:23

that is a fundamental problem, because str could be 1) a fully named namespace, 2) a Java class

borkdude20:11:04

the only way to lint this is using explicitly configuration, it cannot be detected automatically

eraserhd20:11:50

OK, so that becomes more complicated. Either it's a class in java.lang, or it's imported, or there's a defrecord or deftype for it in the namespace, or it's a warning?

eraserhd20:11:51

In terms of configuration, I, personally, would be happy to assume anything starting with a lower case letter is not a Java class.

borkdude20:11:03

goog in CLJS is another example

eraserhd20:11:30

this seems like a fixed number of clojure-flavor related exceptions, e.g. goog/ and js/ in cljs is like System/ in clj.

eraserhd20:11:17

hmm, but ok, it's not so simple

eraserhd20:11:30

I wonder how often this shows up in the wild?

borkdude20:11:06

There as an issue about this which @dominicm linked recently. Let me try to find it...

borkdude20:11:20

This lead to the issue #515

eraserhd20:11:56

Yeah, I was getting to asking whether aliases should be on #515 or a separate issue, but it might be neither.

borkdude20:11:30

@dominicm do you maybe remember which issue that was?

borkdude20:11:33

ah that's it, thanks

borkdude20:11:51

@eraserhd Feel free to have a look at this. We can reconsider this issue at all times.

eraserhd20:11:36

ok. This is closely related to something I've been meaning to do for a while.

eraserhd20:11:52

So, I might actually look at it.

borkdude20:11:21

It's fairly easy to warn when foo is not a required namespace (alias) or imported class. Then we'd have t exclude known things like goog. Clj-kondo already have a list of all the by default available classes, so that's not a problem anymore either. So considering the progress of the last few months, maybe it's actually more feasible now...

borkdude20:11:28

The only thing that should be very well researched is false positives

borkdude20:11:03

I've re-opened the issue and put in the "hammock time" column on the project board

eraserhd20:11:27

I was thinking something like linting 500 big clojure projects and seeing what shakes out.

borkdude20:11:47

so the warning would be something like "missing require or import"?

eraserhd20:11:34

This goes beyond clj-kondo, probably, but a thing that's been on my to-do list for years is a thing that updates ones namespace as one types. Aliases are (or should) be used somewhat consistently in a project, so an analyzer could know what to do. I had this for C++ includes a long time ago, and it worked well.

borkdude20:11:06

> Aliases are (or should) be used somewhat consistently in a project There's actually a linter for this now

borkdude20:11:33

You can generate the initial config using the analysis export which contains all the aliases: https://github.com/borkdude/clj-kondo/tree/master/analysis

borkdude20:11:52

Maybe it could be useful to add the script which generates this config to the analysis examples. Worth a PR if anyone feels like it