clj-kondo

Stig Brautaset 2025-04-16T17:36:52.193189Z

A pattern we use is to reify protocols for test stubs without implementing all the methods. I thought that I could turn the new :missing-protocol-method linter off just in tests using config like this:

:ns-groups [{:pattern ".*-test$" :name test-namespaces}]
 :config-in-ns {test-namespaces {:linters {:missing-protocol-method {:level :info}}}}
However that doesn't seem to work. Am I specifying the :ns-groups incorrectly?

Stig Brautaset 2025-04-16T17:40:14.703059Z

It looks correct, and works for other linters 🤷 Must the specific :missing-protocol-method linter have specific support for it?

borkdude 2025-04-16T17:52:36.378289Z

This was fixed on master

borkdude 2025-04-16T17:54:12.610249Z

Sorry too fast, something related was fixed. Can you make a GitHub issue? You can disable the linter until next release

👍 1
Stig Brautaset 2025-04-16T20:49:21.233939Z

Ah, I see https://github.com/clj-kondo/clj-kondo/pull/2526/files. That looks like it will fix my issue, to be honest. Or does the specific linter need to support ns-groups even when used via config-in-ns like this?

borkdude 2025-04-16T21:02:03.216079Z

since config-in-ns should work with ns-groups I'd expect it to work, but would be good to double check.

Stig Brautaset 2025-04-16T21:07:35.606599Z

Repro suggests it does not work: https://github.com/clj-kondo/clj-kondo/issues/2527

borkdude 2025-04-16T21:08:47.589029Z

repro with master?

borkdude 2025-04-16T21:09:24.038789Z

thanks, I'll test tomorrow (and write a test for it)

Stig Brautaset 2025-04-16T21:09:26.393539Z

Can I run clj-kondo from the git checkout root?

borkdude 2025-04-16T21:09:39.526429Z

yeah you can use a git dep

borkdude 2025-04-16T21:10:44.734429Z

clojure -Sdeps '{:deps {clj-kondo/clj-kondo {:git/url "" :git/sha "bcad7ea524d0c706c77610c829298a118220ee29"}}}' -M -m clj-kondo.main --lint src
you still have to change the SHA, I copied this from an earlier conversation

👍 1
Stig Brautaset 2025-04-16T21:13:42.121699Z

Looks like fixed on master 👍

clojure -Sdeps '{:deps {clj-kondo/clj-kondo {:git/url "" :git/sha "6e809dfe59a6e825108049690c335ad1e89e0524"}}}' -M -m clj-kondo.main --lint src
Cloning: 
Checking out:  at 6e809dfe59a6e825108049690c335ad1e89e0524
...snip...
src/foo_test.clj:7:15: info: Missing protocol method(s): bar
src/foo_test.clj:9:16: info: Unused value: :hello
linting took 60ms, errors: 0, warnings: 0

borkdude 2025-04-16T21:14:46.102469Z

ok, I'll include a fix nonetheless

borkdude 2025-04-16T21:14:50.962149Z

eh test I mean

Stig Brautaset 2025-04-16T21:16:20.823169Z

No worries. Have a nice evening 🙂

Stig Brautaset 2025-04-16T21:27:11.910829Z

PS: thank you for clj-kondo 🙂

1
Stig Brautaset 2025-04-17T16:34:17.485939Z

PS: I created PRs to bump clj-kondo in ~30 repos today, and the new missing-protocol-method found a legitimate issue in one repo, where the protocol implementation used -snake_case for one method when it should have used -kebab-case thanks3

🎉 1