calva icon indicating copy to clipboard operation
calva copied to clipboard

LSP Unused Public Var -> Kondo Redundant Ignore

Open klauswuestefeld opened this issue 10 months ago • 7 comments

Hi! Thanks for Calva!!

With a tiny project like this:

deps.edn

{:paths ["src"]}

src/main.clj

(ns main) (defn foo [] 42)

foo is marked with an info alert:

"code": "clojure-lsp/unused-public-var", "source": "clojure-lsp",

I click on the light bulb and it adds this line before foo:

#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]}

Now that new line is marked with an info alert:

"code": "redundant-ignore", "source": "clj-kondo",

Versions:

Calva 2.0.485 Last Updated 2025-02-02, 17:35:41 Calva Spritz 1.0.5 Last Updated 2025-02-02, 17:35:41 (Calva apparently installs this too, although I don't have LiveShare installed.) VSCode 1.96.4 Date: 2025-01-16T00:16:19.038Z Ubuntu 22.04.5 LTS

What am I doing wrong?

Thanks!

klauswuestefeld avatar Feb 02 '25 21:02 klauswuestefeld

Hi!

Do you have the clj-kondo extension installed? If so, that could be the problem.

PEZ avatar Feb 03 '25 07:02 PEZ

No, I don't have clj-kondo installed.

Can I do anything here to provide more info?

My two team mates have the same issue. And we don't have any special Calva config or anything. I suspect many users are having the same problem.

klauswuestefeld avatar Feb 03 '25 16:02 klauswuestefeld

I suspect this is a clj-kondo issue. If so it is even more people affected. I could reproduce it in Calva with your description. Let's try repro it with clj-kondo alone:

~/Projects/tests/unused-public-var 
❯ clj-kondo --version
clj-kondo v2025.01.16

~/Projects/tests/unused-public-var 
❯ clj-kondo --lint src/main.clj
src/main.clj:3:3: info: Redundant ignore
linting took 18ms, errors: 0, warnings: 0

Yeah, clj-kondo. And it is probably new, because otherwise I would have heard of it before. 😄

Check if it is reported on clj-kondo, otherwise, please report it. Let's keep this issue open until we have a resolution or some more info about it at least.

PEZ avatar Feb 03 '25 16:02 PEZ

I am assuming foo is some kind of API function? You could consider marking foo as exported, like so:

(defn ^:export foo [] 42)

That tells clj-kondo (and humans) not to complain about it not being used in the project.

PEZ avatar Feb 03 '25 16:02 PEZ

Could you report to clj-kondo? If they start questioning me, I would just be a middleman relaying their questions to you.

Thanks for the ^:export tip! My problem is solved.

klauswuestefeld avatar Feb 03 '25 18:02 klauswuestefeld

See this issue and this commit that's linked from that issue.

bpringe avatar Feb 05 '25 21:02 bpringe

It doesn't look like the change linked above has been released yet judging by the time of that commit and the time of the last kondo release, but it seems the solution will involve updating the kondo config.

bpringe avatar Feb 05 '25 21:02 bpringe