Fork me on GitHub
#clj-kondo
<
2022-03-15
>
Sam Ritchie18:03:47

ths is weird… I am having an issue in clj-kondo v2022.03.04 where if I delete my .cache , and then run clj-kondo --lint test/sicmutils/tex_web_test.clj , where sicmutils.tex-web-test IMPORTS sicmutils.env, that in my hook, (api/ns-analysis 'sicmutils.env) returns {}. which makes it impossible for my hook to look at this info and expand to a bunch of declare forms.

Sam Ritchie18:03:42

but then if I explicitly invoke clj-kondofor src, where sicmutils.env lives (basically point it AT the file), then the next time the cache is full

Sam Ritchie18:03:34

so to be clear, if I call this twice:

clj-kondo --lint src:test
it first fails, then succeeds

borkdude18:03:53

yes, that's expected, ns-analysis depends on the cache.

Sam Ritchie18:03:24

but I would have thought the cache would be populated for B by B’s requirements?

Sam Ritchie18:03:29

or is the cache only filled at the end of a run

borkdude18:03:58

there is no pre-analysis of namespace dependencies

borkdude18:03:09

clj-kondo just lints files in random order and figures stuff out and the end

borkdude18:03:49

I'm considering adding a pre-analysis of ns dependencies, but it's currently not there

borkdude18:03:04

it would also complicate parallel linting

Sam Ritchie22:03:18

noticed that #(gensym %) triggers redundant fn wrapper in cljs; but gensym is a macro here, so I would suggest that this be an exception to that rule

dpsutton22:03:07

where is gensym a macro? (repeatedly 5 gensym) and (source gensym) indicate that it is not

borkdude22:03:21

$ plk
ClojureScript 1.10.914
cljs.user=> gensym
#object[Function]

Sam Ritchie23:03:42

Oh I misunderstood from this and a strange test error I was getting

Sam Ritchie23:03:15

Sorry, long day at the REPL! I'll debug that weird error

Sam Ritchie23:03:53

it was this for the record:

actual: #object[TypeError TypeError: cljs.core.gensym.cljs$core$IFn$_invoke$arity$1 is not a function]

Sam Ritchie23:03:18

won’t reproduce at the REPL

borkdude23:03:39

Issue + repro welcome

Sam Ritchie02:03:21

Fixed once I got some rest. I was rebinding gensym but not covering the 0 arity case, since I didn’t think anyone else was calling it inside my with-redefs