clj-kondo

https://github.com/clj-kondo/clj-kondo
Ahmed Hassan 2020-10-16T04:36:11.178100Z

Can't we configure clj-kondo to flag some word or regex? this can flag TODO, FIXME kind of words.

Ahmed Hassan 2020-10-16T21:09:07.195900Z

Yeah, that was missing piece of bb, I can't thank you enough for everything you're doing for community.

Mikko Harju 2020-10-16T06:22:50.179900Z

Hi! What would be the best way to lint a "let-like" macro that has the following signature:

(m/dynamic-let <var> <let-declarations> <body>)

Mikko Harju 2020-10-16T13:22:41.187900Z

@borkdude fixed this with a hook, was very easy. Found a couple of typos in hooks docs, sent a PR to fix them. Thanks!

borkdude 2020-10-16T13:26:19.188100Z

nice :)

borkdude 2020-10-16T13:27:46.188300Z

{:keys [:node]}
isn't a typo though, it's well supported

nate 2020-10-16T14:58:18.194500Z

huh, TIL

Mikko Harju 2020-10-16T16:55:01.194700Z

Same for me. TIL.

Mikko Harju 2020-10-16T17:01:13.194900Z

Fixed the PR to contain just the path change.

borkdude 2020-10-16T17:03:21.195100Z

Merged, thanks

Mikko Harju 2020-10-16T17:04:11.195300Z

NP!

Mikko Harju 2020-10-16T06:29:40.180400Z

I mean, I can just ignore the unresolved symbols altogether, but I'm interested if I could somehow piggyback on the let-declaration to get linting on the body based on the let-declarations.

dharrigan 2020-10-16T06:29:53.180600Z

lint-as

Mikko Harju 2020-10-16T06:31:58.181100Z

It doesn't work directly as I have one parameter before the let declarations

borkdude 2020-10-16T06:34:57.182700Z

@mikko lint as Clojure.core/fn?

Mikko Harju 2020-10-16T06:35:32.182900Z

😮 of course!

Mikko Harju 2020-10-16T06:36:16.183100Z

Ah – a minor caveat...

Mikko Harju 2020-10-16T06:36:51.183300Z

(m/let-dynamic dynamic-sub
  [data (if sub (re/subscribe sub) (atom nil))

Mikko Harju 2020-10-16T06:37:12.183600Z

that does not work since fn cannot have dynamic declarations... Close but no cigar 🙂

borkdude 2020-10-16T06:38:03.184700Z

Ah. You can write a hook for it then, or suppress the unresolved symbols

Mikko Harju 2020-10-16T06:38:30.185Z

I'll dig into the hooks, thanks for the tip!

borkdude 2020-10-16T06:39:29.186400Z

Btw I remember that you once used babashka for a lot of requests with bb curl right? And this created too many processes on your machine

borkdude 2020-10-16T06:40:15.187600Z

There is now also org.httpkit.client built in which is also async

2020-10-16T13:38:30.189200Z

is there anything around that uses clj-kondo to generate a static callgraph given a codebase?

2020-10-16T13:38:55.189800Z

and btw I noticed that both clj-kondo and clindex in their analysis return var, but don't know anything about functions for example

2020-10-16T13:39:11.190300Z

is that a limitation of the underlying analysis library I guess?

borkdude 2020-10-16T13:41:39.191700Z

not sure what you mean with "don't know anything about functions" but the above library utilizes clj-kondo for making callgraphs, so yes, it's possible

2020-10-16T13:46:57.192300Z

I mean that you get var-definitions and var-usages, but I could not see how to say if a var referred to a function

2020-10-16T13:47:07.192700Z

or something else, only macros were distinguished from what I could see

borkdude 2020-10-16T13:47:50.193100Z

@andrea.crotti How do you think carve does this?

2020-10-16T14:10:31.193200Z

yeah I looked at carve as well

2020-10-16T14:11:21.193400Z

but I can't really see that it distinguishes between variables and functions

2020-10-16T14:11:30.193600Z

but it probably just doesn't need to

borkdude 2020-10-16T14:26:21.193900Z

ah now I see what you mean

borkdude 2020-10-16T14:26:29.194100Z

I think if there is no arity information, it's not a function - maybe

2020-10-16T14:32:20.194300Z

ah ok yeah that already helps