clj-kondo

https://github.com/clj-kondo/clj-kondo
borkdude 2020-09-03T07:49:46.021800Z

Updated proposal regarding the above issue about ignoring warnings: https://github.com/borkdude/clj-kondo/issues/872#issuecomment-686315535

robert-stuttaford 2020-09-03T12:48:07.022700Z

any chance of a new release soon, @borkdude? 🙂 keen to get that rum fix into general circulation here at Cognician

borkdude 2020-09-03T12:48:38.023Z

@robert-stuttaford The Rum fix is entirely done in user space

borkdude 2020-09-03T12:48:44.023200Z

no need for a release

robert-stuttaford 2020-09-03T12:48:46.023400Z

oh!

robert-stuttaford 2020-09-03T12:48:57.023700Z

i'll do my homework, thanks+sorryforthenoise

borkdude 2020-09-03T12:49:37.024200Z

No problem! I'm glad it can be done in user space, since I got another report about it: https://github.com/borkdude/clj-kondo/issues/987 Multi-arity components...

💯 1
borkdude 2020-09-03T12:50:04.025Z

If anyone feels challenged to pick it up, be my guest, else I'll get to it after some other stuff

robert-stuttaford 2020-09-03T12:50:26.025300Z

gosh how did i miss that 😊:face_palm:

borkdude 2020-09-03T12:51:03.025500Z

Really no problem :)

robert-stuttaford 2020-09-03T12:52:33.025800Z

omg omg it works yay

robert-stuttaford 2020-09-03T12:52:58.026200Z

think of me when you have that next sponsored coffee thing, haha

borkdude 2020-09-03T12:54:00.027400Z

I will tomorrow, thanks for sponsoring ;) Hopefully there will be a release somewhere in the middle of this month, featuring this new thing: https://github.com/borkdude/clj-kondo/issues/872#issuecomment-686315535 If you have any ideas about it, there's still time

robert-stuttaford 2020-09-03T13:00:22.028400Z

very interesting! i don't have anything of value to add. we live with our linting errors, but clean them up as we work through old places

borkdude 2020-09-03T13:00:43.028700Z

same here on my work projects

robert-stuttaford 2020-09-03T14:26:51.030Z

@borkdude do you perhaps have any guidance / writing on integrating kondo into a clojure app (e.g. a web app) to lint EDN editors inside CMSes? so basically https://clj-kondo.michielborkent.nl/ but with the server side using kondo-in-jvm-clojure instead of shelling out to the bb version?

robert-stuttaford 2020-09-03T14:27:31.030600Z

we can't be the first ppl to do this, i'm thinking!

borkdude 2020-09-03T14:27:34.030700Z

that front-end is shelling out to the clj-kondo binary, it has nothing to do with bb, but I get the point: shelling out.

borkdude 2020-09-03T14:28:22.031300Z

Well, you could use clj-kondo JVM in your server and just send the lint information back to the front-end?

borkdude 2020-09-03T14:28:34.031600Z

basically the same, but just using the JVM, not shelling out

borkdude 2020-09-03T14:29:11.031800Z

The source code is here: https://github.com/borkdude/clj-kondo.web

borkdude 2020-09-03T14:29:31.032400Z

I used CodeMirror, but there are also alternatives to this. I was just familiar with that one, it has a linting plugin to display warnings

robert-stuttaford 2020-09-03T14:29:50.033Z

yeah super happy to use that

robert-stuttaford 2020-09-03T14:30:26.033300Z

found the jvm api doc nice

borkdude 2020-09-03T14:31:14.033500Z

yeah, should also be on cljdoc: https://cljdoc.org/d/clj-kondo/clj-kondo/2020.07.29/api/clj-kondo.core

borkdude 2020-09-03T14:31:50.033900Z

I see I forgot a {:no-doc} in an impl namespace :)

borkdude 2020-09-03T14:32:30.034300Z

@robert-stuttaford If you want something lighter weight than clj-kondo, you might also want to look at edamame

borkdude 2020-09-03T14:32:42.034500Z

https://github.com/borkdude/edamame

borkdude 2020-09-03T14:33:13.035Z

it spits out location data also on error, in an ex-info

robert-stuttaford 2020-09-03T14:33:37.035600Z

ahhh that might be all we need, because it's only EDN we need to lint

robert-stuttaford 2020-09-03T14:34:24.036400Z

well kondo will give a list of all the linting issues right, which we can then send back for codemirror to display

borkdude 2020-09-03T14:35:05.036600Z

@robert-stuttaford

user=> (require '[edamame.core :as e])
nil
user=> (e/parse-string "{")
Execution error (ExceptionInfo) at edamame.impl.parser/throw-reader (parser.cljc:89).
EOF while reading, expected } to match { at [1,1]
user=> (ex-data *e)
{:type :edamame/error, :row 1, :col 2}

borkdude 2020-09-03T14:35:30.036900Z

That's true, edamame will just stop parsing on error.

robert-stuttaford 2020-09-03T14:36:13.037200Z

right

borkdude 2020-09-03T14:36:51.037800Z

we could also build that into edamame probably, I haven't really given it much thought yet

borkdude 2020-09-03T14:38:43.038800Z

you could also use both, since you can also verify a valid EDN structure according your own rules and give extra lint warnings if it doesn't conform to your specs for example

borkdude 2020-09-03T14:38:55.039200Z

edamame attaches location information where possible

borkdude 2020-09-03T14:39:28.039900Z

there's also a mode to return different kinds of nodes instead of numbers and strings, so you can still have location info for those as well

borkdude 2020-09-03T14:40:49.040600Z

There's also a docker image for clj-kondo: you might get away with using that instead of the binary on the server as well. Anyway, plenty of ideas :)

robert-stuttaford 2020-09-03T14:43:23.041Z

thanks dude!

borkdude 2020-09-03T15:39:16.041800Z

@robert-stuttaford Note that you can lint strings using (with-in-str "(+ :foo)" (clj-kondo/run! {:lint ["-"]}))

robert-stuttaford 2020-09-03T16:12:05.042100Z

sweet thank you, that's what we'll probably end up doing!

borkdude 2020-09-03T20:56:34.042400Z

Little update: https://github.com/borkdude/clj-kondo/issues/872#issuecomment-686760114