Fork me on GitHub
#clj-kondo
<
2021-05-04
>
pinkfrog09:05:19

@borkdude Is it possible to tell carve to ignore a clj file, instead of some symboles

borkdude09:05:49

@i carve has :api-namespaces where it won't look at public unused vars, maybe this works for you?

borkdude09:05:06

it uses the name of the namespace, not the filename

pinkfrog09:05:27

Is this the correct form?

pinkfrog09:05:30

{:api-namespaces ['mocks]}

pinkfrog09:05:53

❯❯❯ clojure -M:carve --opts '{:paths ["src"]}'                                                                                     

Carving src/mocks.cljs

Found unused var:
------------------
(def action-button          #js {:default #js {:Item #js {}}})
------------------
Type Y to remove or i to add mocks/action-button to .carve/ignore

pinkfrog09:05:58

Still got the above output.

pinkfrog11:05:26

the {:api-namespaces [’mocks]} should be correct. But it doesn’t work on my side.

borkdude11:05:44

where did you put this?

borkdude11:05:00

in an EDN file you should not use the quote

pinkfrog13:05:30

Thanks. Removing the quote makes it work.

pinkfrog13:05:57

Is it possible to instruct carve to ignore all clj files that has the name of xxx_test.clj ?

borkdude13:05:49

@i carve should already ignore deftest vars

pinkfrog13:05:47

Thanks. That’s the case.

pinkfrog10:05:27

clj-kondo doesn’t catch unused variables? How to configure it?

borkdude10:05:57

variables = vars?

borkdude10:05:28

clj-kondo itself doesn't have that feature, but it's available as part of its analysis output

pinkfrog10:05:01

Yup. I was trying to use carve. And suddenly got aware that clj-kondo has the unused feature covered: https://github.com/clj-kondo/clj-kondo#features

pinkfrog10:05:21

So what DIRECT feature is supported by clj-kondo?

borkdude11:05:21

clj-kondo only reports unused private vars, not unused public vars

borkdude11:05:24

but clojure-lsp does

borkdude10:05:43

you can use clojure-lsp lens-mode if you want to display usages inline in your editor, which uses this analysis