Fork me on GitHub
Ferdinand Beyer13:04:48

I might have found a bug Malli’s clj-kondo type config generation when using :re schemas. Instead of expecting a string matching a regular expression, clj-kondo expects an argument to be of regular expression type. Or did I misunderstand something?


can you share the clj-kondo configuration for that function?

Ferdinand Beyer15:04:07

Unfortunately I deleted this example file already, but I can confirm that I get :regex in the config, and I agree that this should probably be :string

Ferdinand Beyer15:04:42

Having said that, I never worked with clj-kondo that deeply so I don’t know what ops/types it accepts


looks like the :regex type in kondo expects a regex: added this to the config:

$ cat .clj-kondo/config.edn
  {:level :warning
   :namespaces {foo {foo {:arities {1 {:args [:regex] :ret :string}}}}}}}}


and then:

$ clj-kondo --lint - <<<'(ns bar (:require [foo :refer [foo]])) (foo "")'
<stdin>:1:45: warning: Expected: regular expression, received: string.
linting took 12ms, errors: 0, warnings: 1
$ clj-kondo --lint - <<<'(ns bar (:require [foo :refer [foo]])) (foo #"")'
linting took 11ms, errors: 0, warnings: 0


Merged, thanks!

Ferdinand Beyer08:05:44

That was fast, thanks 🙂

Keith Houser18:04:26

Why does humanize not have "Wrong!!" message when wrong value is in the first position?

({:forms (d),
  :human [["should be a" "should be b" "should be c"]]}
 {:forms (a d c),
  :human [nil ["should be a" "should be b" "should be c" "Wrong!!"]]})