Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LSP Unused Public Var -> Kondo Redundant Ignore #2722

Open
klauswuestefeld opened this issue Feb 2, 2025 · 7 comments
Open

LSP Unused Public Var -> Kondo Redundant Ignore #2722

klauswuestefeld opened this issue Feb 2, 2025 · 7 comments

Comments

@klauswuestefeld
Copy link

klauswuestefeld commented Feb 2, 2025

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!

@PEZ
Copy link
Collaborator

PEZ commented Feb 3, 2025

Hi!

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

@klauswuestefeld
Copy link
Author

klauswuestefeld commented Feb 3, 2025

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.

@PEZ
Copy link
Collaborator

PEZ commented Feb 3, 2025

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
Copy link
Collaborator

PEZ commented Feb 3, 2025

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.

@klauswuestefeld
Copy link
Author

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.

@bpringe
Copy link
Member

bpringe commented Feb 5, 2025

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

@bpringe
Copy link
Member

bpringe commented Feb 5, 2025

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants