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?It looks correct, and works for other linters 🤷
Must the specific :missing-protocol-method linter have specific support for it?
This was fixed on master
Sorry too fast, something related was fixed. Can you make a GitHub issue? You can disable the linter until next release
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?
since config-in-ns should work with ns-groups I'd expect it to work, but would be good to double check.
Repro suggests it does not work: https://github.com/clj-kondo/clj-kondo/issues/2527
repro with master?
thanks, I'll test tomorrow (and write a test for it)
Can I run clj-kondo from the git checkout root?
yeah you can use a git dep
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 conversationLooks 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
ok, I'll include a fix nonetheless
eh test I mean
No worries. Have a nice evening 🙂
PS: thank you for clj-kondo 🙂
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