Fork me on GitHub
Oliver George00:05:04

Am I missing something obvious for treating code as data and interrogating it? The code is all Clojurescript. I've been playing with clj-rewrite. What I really want is to write scripts which analyse my source code - looking for undesirable code patterns, estimating complexity, priporitising testing effort on usage, KPIs around prepost use, it goes on... Reading is non trivial because of read macros. So clj-rewrite is nice. Then it gets fiddly because of needing to resolve aliases (manually got around the worst of this by parsing the ns forms). Feels like a script which reads, resolves and shoves everything into a datascript db would be good. I think perhaps that's what clj-kondo used to do but perhaps that changed. Haven't tried edamame yet.

Oliver George01:05:17

Thanks. I got the impression that's more limited in scope but I'll look again.


Well, clj-kondo uses rewrite-clj to read Clojure. But then it interprets it for the purposes of linting. You get access to those interpretations via data analysis.

☝️ 1

There’s a chance it might not meet your requirements, but probably worth another look-see.

Oliver George01:05:21

It does generate lots of useful data.


Take a look at grasp as well (Google borkdude grasp)


On the phone so I can't paste link

Oliver George06:05:12

Thanks @U04V15CAJ I was having a great time with that this morning. Was able to do things like "find maps with a specific key where the value is missing something". Worked like a charm with very little code. Brilliant stuff.

Oliver George06:05:37

What is it using under the hood? The deps didn't reveal much.


It's using spec under the hood :)


And SCI, but only for resolving var names, not really for anything fancy

Oliver George07:05:19

Nice. And Sci, in turn, uses edamame.