clj-kondo

https://github.com/clj-kondo/clj-kondo
2021-05-04T09:07:19.404700Z

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

borkdude 2021-05-04T09:08:49.405200Z

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

borkdude 2021-05-04T09:09:06.405500Z

it uses the name of the namespace, not the filename

2021-05-04T09:15:27.405600Z

Is this the correct form?

2021-05-04T09:15:30.405800Z

{:api-namespaces ['mocks]}

2021-05-04T09:15:53.406Z

❯❯❯ 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

2021-05-04T09:15:58.406200Z

Still got the above output.

2021-05-04T10:54:27.406800Z

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

borkdude 2021-05-04T10:54:57.407Z

variables = vars?

borkdude 2021-05-04T10:55:28.407400Z

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

borkdude 2021-05-04T10:55:43.407800Z

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

2021-05-04T10:59:01.408Z

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

2021-05-04T10:59:21.408300Z

So what DIRECT feature is supported by clj-kondo?

borkdude 2021-05-04T11:00:21.408800Z

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

borkdude 2021-05-04T11:00:24.409Z

but clojure-lsp does

2021-05-04T11:00:26.409200Z

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

borkdude 2021-05-04T11:00:44.409400Z

where did you put this?

borkdude 2021-05-04T11:01:00.409600Z

in an EDN file you should not use the quote

2021-05-04T13:40:30.409800Z

Thanks. Removing the quote makes it work.

2021-05-04T13:40:57.410Z

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

borkdude 2021-05-04T13:41:49.410200Z

@i carve should already ignore deftest vars

2021-05-04T13:44:47.410400Z

Thanks. That’s the case.