Fork me on GitHub
#clj-kondo
<
2024-03-07
>
Mateusz Mazurczak11:03:49

Hi, I've added in the .clj-kondo/config.edn following lines to the map:

:linters
 {:unresolved-symbol
  {:exclude [(portfolio.reagent-18/defscene)
             (automaton-web.portfolio.proxy/defdisplay)]}}
So that portfolio (library) custom macros functions won't give clj-kondo warnings. Which causes .clj-kondo to add directory, and file: .clj-kondo/no.cjohansen/portfolio/config.edn Which is empty and gives a warning from clj-kondo. Adding empty map there, makes condo overwrite it with empty file.

borkdude11:03:14

I'll take a look later today

❤️ 1
borkdude18:03:37

yes, it's that portfolio issue nr 22

borkdude18:03:36

can you show me your deps.edn?

borkdude19:03:34

let's discuss further in that issue

dmegas17:03:31

In some cases I use the template method pattern as seen on https://mishadoff.com/blog/clojure-design-patterns/#episode-5-template-method. I know it probably is not feasible but here goes: Could clj-kondo help in identifying, for instance, if a template method provided has the wrong arity? For example:

(defn mage-handle-chest [chest]
;; implementation
)

(defn mage-attack [enemies some-other-param]
;; implementation

(defn move-to [character location
               & {:keys [handle-chest attack]}
                  
  ;; implementation calling the template methods `handle-chest` and `attack`
  ;; `attack` will be called with one argument, can clj-kondo identify that at a calling site the `attack` fn passed, is a 2 argument function?
                                                ^^^^^^^^^^^^^
)

;; Calling site
(move-to character location
  :handle-chest mage-handle-chest
;; `mage-attack` requires 2 arguments to be passed, but `move-to` will call it with 1
                 ^^^^^^^^^^^^^^^^^^^^
  :attack       mage-attack)

borkdude18:03:53

currently clj-kondo's "type. system" isn't advanced enough to capture this

dmegas19:03:31

Makes sense, thank you!

valerauko13:03:53

malli could help maybe?

dmegas11:03:30

you mean like a function spec? But that would require instrumentation, right? I would love for sth without instrumentation, maybe core.typed… :thinking_face: