Fork me on GitHub
#clj-kondo
<
2021-11-12
>
mynomoto17:11:51

Can clj-kondo warn on spec redefinitions?

borkdude20:11:16

Within the same file you mean?

mynomoto20:11:18

I mean everywhere but would gladly use on the same file too 😉

borkdude20:11:49

How would clj-kondo know which spec overwrites which other one?

borkdude20:11:07

I think you could already use the clj-kondo analysis for this if you want to script this yourself btw

👍 1
mynomoto20:11:06

It could be a warning of multiple definitions, no needed to tell which one is overwriting the other.

borkdude20:11:43

True. Are you using clojure-lsp?

borkdude20:11:13

clojure-lsp already provides navigation to specs using keywords (using the same analysis). perhaps it would be a small extra step for it.

mynomoto20:11:06

It navigates to one of the multiple definitions ATM.

borkdude20:11:45

yes. but because it already keeps track of these definitions, it can catch duplicates fairly easily and perhaps warn: this spec is also defined in another file

ericdallo20:11:55

yes, I think it could work, maybe a custom lint?

ericdallo22:11:33

@U05094X3J feel free to create a issue about clojure-lsp warn about duplicate definitions, sane examples would help a lot

👍 1