I'm getting an error that says unresolved symbol merge identity
In my .clj-kondo/config.edn
I added this:
{:lint-as {clojure.test.check.properties/for-all clojure.core/let
clojure.test.check.clojure-test/defspec clj-kondo.lint-as/def-catch-all}}
Am I missing something?can you also provide the namespace form? this way I can verify if you made the right config
(ns properties-playground.test-check.merge-test
(:require [clojure.test :refer :all]
[clojure.test.check.clojure-test :refer [defspec]]
[clojure.test.check.properties :as prop]
[clojure.test.check.generators :as gen]))
@juan.ignacio848 This does not give any unresolved symbols for me:
(ns properties-playground.test-check.merge-test
{:clj-kondo/config '{:lint-as {clojure.test.check.clojure-test/defspec clj-kondo.lint-as/def-catch-all}}}
(:require [clojure.test :refer :all]
[clojure.test.check.clojure-test :refer [defspec]]
[clojure.test.check.properties :as prop]
[clojure.test.check.generators :as gen]))
(defspec merge-identity
(prop/for-all [m1 (gen/map gen/keyword gen/small-integer)]
(= m1
(merge m1 {})
(merge {} m1))))
The map you added in the namespace form is equivalent to having the config.edn?
yes
what version of clj-kondo are you using?
def-catch-all is something new? I don't remember when was the last time I updated clj-kondo 🙂
just upgrade, then try again
v2019.11.23
It's probably that 🙂 I'll try
https://github.com/borkdude/clj-kondo/releases/tag/v2020.01.10 --> def-catch-all
btw you can also try clojure.core/def
for better linting. the catch-all is a last resort really
prop/for-all can be linted like let like you already had
[nmkip@nmkip-pc test_check]$ clj-kondo --lint merge_test.clj
merge_test.clj:2:34: warning: use alias or :refer
linting took 20ms, errors: 0, warnings: 1
Ohh, my auto-completion didn't recommended me clojure.core/def, it was my first attempt though
however there's also another arity for defspec
which I'm not using so I will change it to clojure.core/def
it does seem to work:
(ns properties-playground.test-check.merge-test
{:clj-kondo/config '{:lint-as {clojure.test.check.clojure-test/defspec clojure.core/def
clojure.test.check.properties/for-all clojure.core/let}}}
(:require [clojure.test :refer :all]
[clojure.test.check.clojure-test :refer [defspec]]
[clojure.test.check.properties :as prop]
[clojure.test.check.generators :as gen]))
(defspec merge-identity 100
(prop/for-all [m1 (gen/map gen/keyword gen/small-integer)]
(= m1
(merge m1 {})
(merge {} m1))))
This is probably a lack of clojure.core/def syntax checking that works out nice for this use case. Might break in the future if syntax checking improves 😉
Yes, it works 😄
Thanks!