clj-kondo

https://github.com/clj-kondo/clj-kondo
borkdude 2020-10-10T07:00:20.135200Z

You can save it in .clj-kondo for sure

borkdude 2020-10-10T09:54:52.135500Z

Clj-kondo v2020.10.10 New: shadowed var linter and various improvements and fixes Release notes: https://github.com/borkdude/clj-kondo/blob/master/CHANGELOG.md#v20201010 This release is funded by Clojurists Together.

5
Luis Santos 2020-10-10T11:40:59.140500Z

Hi Maybe this is an existing feature but I cannot find information about it. Would it be possible to annotate a macro, using metadata, with lint-as rule so that I can have out-of-box linting support? And if not is there a technical limitation or would it be a bad practice to do this? Thanks for all great work.

borkdude 2020-10-10T11:45:26.141800Z

@luis559 Hi. This is not supported, since that would rely on clj-kondo linting the source of your macro in the right order, or at all and clj-kondo is not designed in such a way: it's designed to deal with incomplete information. A better way is to PR your config here: https://github.com/clj-kondo/config and then install the config using that lib.

borkdude 2020-10-10T11:46:35.142500Z

I'm still considering something like picking up config from the classpath, but it's not yet clear

borkdude 2020-10-10T11:46:56.142800Z

I think the config library could also be made to handle that

borkdude 2020-10-10T11:47:32.143400Z

So then users could provide a clj-kondo.config/your.org/your.lib/config.edn directory on the classpath

borkdude 2020-10-10T11:47:39.143600Z

and this will then be copied, or something like that

borkdude 2020-10-10T11:49:34.145Z

The issue for that is this one: https://github.com/clj-kondo/config/issues/1

Luis Santos 2020-10-10T11:51:36.146400Z

The classpath option sounds promising as well. Thanks for explanation. Looking forward to see how it evolves. Thanks.

fiddlerwoaroof 2020-10-10T17:14:42.147200Z

I guess I was thinking more in terms of a database with an API that tools can be written against. I'd like to be able to query for code construvts with datalog or SQL, for example.

fiddlerwoaroof 2020-10-10T17:16:37.147400Z

Anyways, my grand vision for programming is more smalltalk-image shaped and less file shaped

borkdude 2020-10-10T18:14:28.147600Z

totally possible to make a tool which puts clj-kondo's data into a SQL db: https://github.com/borkdude/babashka/blob/master/examples/hsqldb_unused_vars.clj

2020-10-10T20:16:04.148Z

The downsides of that is for an Emacs editing environment you now have to manage long lived subprocesses and that comes with its own issues.

borkdude 2020-10-10T20:17:19.148300Z

@didibus babashka + hsqldb is pretty fast, and not long lived, milliseconds

borkdude 2020-10-10T20:19:49.148500Z

I haven't tested the feasibility of this, but you can try out the example in your own machine to see how it performs

2020-10-10T20:22:21.148700Z

Hum... like if I didn't maintain a cache? It means clj-kondo would need to re-analyse all files every edit and re-initialize hsqldb and insert all vars and then run the query.

2020-10-10T20:22:56.148900Z

I don't know maybe clj-kondo and hsqldb are that fast

borkdude 2020-10-10T20:23:10.149100Z

this is just an example of how to use hsqldb. I mean: you could maintain your own cache in a hsqldb

borkdude 2020-10-10T20:23:24.149300Z

I'm not sure either

2020-10-10T20:23:25.149500Z

Right, that's what I meant by long lived process

borkdude 2020-10-10T20:23:43.149700Z

no, it's persisted to disk?

2020-10-10T20:23:46.149900Z

If I maintain my cache in a DB, that's a seperate process that Emacs as to start and manage

2020-10-10T20:24:00.150200Z

Oh, is it?

2020-10-10T20:24:29.150400Z

So you start hsql run some query over a a file based table and then kill it?

borkdude 2020-10-10T20:24:31.150600Z

yeah. you can use it with babashka to create ad hoc databases on your file system, just like sqlite

borkdude 2020-10-10T20:25:18.150800Z

sqlite is also an option btw, if emacs has support for that somehow

2020-10-10T20:25:21.151Z

Ok, that's interesting then, I'll think about it. Could make my code easier, querying data-structures in Emacs is alright but that would make it much nicer

borkdude 2020-10-10T20:26:27.151200Z

so, the support for hsqldb from within babashka comes from here: https://github.com/babashka/babashka-sql-pods/

2020-10-10T20:27:16.151400Z

There's the downside of having users need to install one more binary, but I guess they are already expected to install clj-kondo

borkdude 2020-10-10T20:27:55.151600Z

That's for sure. Of course you could also make your own anakondo binary with GraalVM and use clj-kondo from there.

borkdude 2020-10-10T20:28:07.151800Z

and include whatever database / EDN / EQL stuff you want

borkdude 2020-10-10T20:28:45.152Z

Postgres and HSQLDB (embedded) are the only databases I've gotten to work with GraalVM

2020-10-10T20:29:38.152200Z

Hum, ya that could be an option as well. I'll hammock on it all. Though at this point I wouldn't really see myself making a major refactor of that sort unless it really helped me down the road. But I like the ideas.