Fork me on GitHub
#clj-kondo
<
2023-02-16
>
Cam Saul19:02:46

Question about writing custom hooks: Is there some way to take a symbol/token node and get the fully-qualified version of a symbol that is using a namespace alias? Motivating example: I'm working on a custom linter that will complain if you use certain forms e.g. with-redefs inside parallel tests (we're using a test runner that supports parallel tests). I have it working where it can walk the node and find the symbol with-redefs and error, but it doesn't detect situations if you do something like

(ns my-ns
  (:require [clojure.core :as core]))

(deftest ^:parallel my-test
  (core/with-redefs [...]
    ...))
I would like the hook to be able to take a with-redefs token node or core/with-redefs token node and figure out that in this namespace it's referring to clojure.core/with-redefs . I could figure this out myself if I had access to ns-aliases or something for the namespace being linted

borkdude19:02:15

Not currently, but I think we could expose this

borkdude19:02:53

Issue welcome

Cam Saul19:02:02

ok, I'll open one. Thanks!

borkdude13:02:39

Released

🎉 2
prnc20:02:44

Hi 👋, with clj-kondo v2023.01.20 I’m seeing unsupported binding form m/scan (`m` is for meander) being classified as an error is there a way to exclude m/scan etc from this check (couldn’t find :unsuported-binding-form linter), or is there some other config parameter I should be looking at? Thanks

borkdude20:02:21

@U7MHWDLD8 Can you provide some more info, e.g. a code snippet in which this occurs?

prnc20:02:02

sure thing!

prnc20:02:45

This would be a simple example

(m/search images-data
  (m/scan
   {::url    ?url})
  {:something/uri        (make-uri-entity ?url)})

prnc20:02:15

I don’t think I’ve seen it before but I was on a very old version of clj-kondo 😅

borkdude20:02:47

Are you using any configuration in .clj-kondo/config.edn for meander?

prnc20:02:11

:face_palm: It was this:

{:lint-as {,,,
           meander.epsilon/match  clojure.core.match/match
           meander.epsilon/search clojure.core.match/match
           ,,,}}

prnc20:02:42

All is good in the world again, thank you @U04V15CAJ

borkdude20:02:22

Release coming tomorrow with a substantial list of new things and improvements: https://github.com/clj-kondo/clj-kondo/blob/master/CHANGELOG.md#unreleased Please try it out from master, if you're able to. Here is how you can run clojure-lsp + clj-kondo from master: https://github.com/clj-kondo/clj-kondo/issues/1995#issuecomment-1432832765

🔥 6