Fork me on GitHub
#clj-kondo
<
2022-09-15
>
sheluchin17:09:28

@borkdude I almost have a fix for #1758, but just one quick question. What is going on https://github.com/clj-kondo/clj-kondo/blob/master/src/clj_kondo/impl/overrides.clj#L49-L57? Why is it assoc'ing cljs.core into both [:cljc :defs cljs.core :clj ...] and [:cljc :defs cljs.core :cljs ...] (both :cljs and :clj)?

borkdude17:09:35

@alex.sheluchin This has to do with some things being both functions and macros in CLJS

sheluchin18:09:49

Okay, that makes sense. I can't seem to find any examples of how to get the :var-definition of something from clojure.core to compare it against the overrides in a test.

sheluchin19:09:01

Ah, got it now.

👍 1
sheluchin14:09:26

@borkdude I put the PR up for #1758. I don't know if putting the overrides check right in reg-var! is a great idea in terms of performance. The other options would be to get the overrides map higher up in the call chain and pass it down to reg-var!, either in a new parameter, or attached to ctx.

sheluchin14:09:46

Hmm, build failed :thinking_face:

❤️ 1
borkdude15:09:34

Maybe you "fixed" the analysis which expects a specific result :-D

borkdude15:09:11

only lein test :only clj-kondo.analysis-test/analysis-test is failing

👀 1
sheluchin15:09:28

I'm getting the same result on master though.

borkdude15:09:51

@alex.sheluchin This is likely an effect of what your changes do to what's stored in the cache

borkdude15:09:58

Try rm -rf .clj-kondo/.cache

sheluchin15:09:55

@borkdude indeed, that was it. But the test also passes back in my branch after:

✔ ~/repos/clj-kondo [add-overrides-to-reg-var L|…3]
$ rm -rf .clj-kondo/.cache/

✔ ~/repos/clj-kondo [add-overrides-to-reg-var L|…3]
$ clojure -M:test -v clj-kondo.analysis-test/analysis-test
Ran 1 tests containing 37 assertions.
0 failures, 0 errors.

borkdude15:09:40

you mean, getting rid of the analysis fixed your problem?

borkdude15:09:48

perhaps run all tests again

borkdude15:09:05

it is likely that analyzing clojure.core will produce the problem

borkdude15:09:10

and this is done during the tests

sheluchin15:09:14

Yep, that's it. Okay, thanks for the tips. I gotta run for now but I'll fix it when I get back.

👍 1
sheluchin23:09:19

I'm not sure what's going on with the builds but I believe it's fixed.

grzm19:09:24

I'm seeing what looks like config caching when running clj-kondo. The behavior I'm seeing: • clj-kondo --lint src in directory I haven't run clj-kondo in before. No .clj-kondo directory in pwd. • see undefined vars from a dependency (due to symbols being generated at run-time) • create a .clj-kondo/config.edn file which includes {:config-paths ["../some-dependency/.clj-kondo"]}. some-dependency/.clj-kondo/config.edn excludes those dynamically created vars • clj-kondo in original directory no longer complains about the undefined vars. • rm -rf ./clj-kondo/ to try to reproduce the original undefined vars message • clj-kondo --lint src still no has no complaint about the original undefined vars I know this has to be user error. I haven't been able to create a small repro case yet (and the actual code is internal so I don't feel comfortable sharing it here). Is there clj-kondo config possibly getting cached someplace else?

borkdude20:09:06

Not that I know of, but perhaps you also have a config in your home dir?

grzm20:09:55

I do. I’ll delete that and try again. FWIW, both a coworker and I are seeing the same behavior. I hate asking for help with such vague details. I’ll see how else I can slice this into smaller pieces.

grzm20:09:56

Does clj-kondo look for .clj-kondo/config in parent directories?

grzm20:09:54

Okay. I think I found out what’s going on. The results are being returned in different orders, so what was apparently “missing” is actually just returned in a different location.

grzm20:09:01

Actually, I don’t know if that’s it, either.

borkdude20:09:13

Yes, clj-kondo looks in parent directories for .clj-kondo dirs

borkdude20:09:22

the first parent .clj-kondo directory is considered the project root

grzm21:09:50

I think that may have played a role in what I was seeing. Thanks for confirming.

grzm21:09:32

The last piece I need to track down (some other time) is why I’m not seeing a :lint-as getting transitively pulled in from a referenced clj-kondo/config.edn. Too many plates spinning right now to dig into that when I can patch it with a little duplication.