简体   繁体   中英

clj-condo redefined-var warning for redefined factory function of record

I am using a defrecord form to define a type in Clojure:

(defrecord HideTableColumnMarker [columns-resize]
  ControlMarker)

But I am not happy with the default factory function function from the defrecord form, so I overwrite it with my own implementation to provide a 0-arity:

(defn ->HideTableColumnMarker
  ([] (HideTableColumnMarker. :cut))
  ([x] (HideTableColumnMarker. x)))

Running clj-kondo gives a redefined-var error:

src/stencil/types.clj:28:1: warning: redefined var #'stencil.types/->HideTableColumnMarker

Which makes sense but I did it on purpose. I have tried to undef the var from the namespace before the defn form but the warning message remains. How can I fix the warning without changing the configuration for clj-kondo?

You could try #_:clj-kondo/ignore before the defn , which should ignore all warnings in the following expression.

See the clj-kondo docs

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM