From 6dac281acfd993add5a55c698a16c9c89a1104c2 Mon Sep 17 00:00:00 2001 From: Tom Dalziel Date: Fri, 24 Nov 2023 12:47:26 +0100 Subject: [PATCH] Update error message to refer to params & arity clause --- doc/linters.md | 2 +- src/clj_kondo/impl/analyzer.clj | 2 +- test/clj_kondo/main_test.clj | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/doc/linters.md b/doc/linters.md index 68d4053174..431bdb1f94 100644 --- a/doc/linters.md +++ b/doc/linters.md @@ -857,7 +857,7 @@ be an unquoted symbol. *Example trigger:* `(fn :fn-name [x] (inc x))`. -*Example message:* `First arg of fn should be a symbol, arg vector or body list`. +*Example message:* `First arg of fn should be a symbol, params vector or arity clause`. *Config:* diff --git a/src/clj_kondo/impl/analyzer.clj b/src/clj_kondo/impl/analyzer.clj index ed37527cd8..b4b57eaf07 100644 --- a/src/clj_kondo/impl/analyzer.clj +++ b/src/clj_kondo/impl/analyzer.clj @@ -947,7 +947,7 @@ filename expr :invalid-fn-name - "First arg of fn should be a symbol, arg vector or body list"))) + "First arg of fn should be a symbol, params vector or arity clause"))) (defn- def-fn? [{:keys [callstack]}] (let [[_ parent extra-parent] callstack] diff --git a/test/clj_kondo/main_test.clj b/test/clj_kondo/main_test.clj index a94b6c4eba..4655c6925e 100644 --- a/test/clj_kondo/main_test.clj +++ b/test/clj_kondo/main_test.clj @@ -61,19 +61,19 @@ (deftest invalid-fn-name-test (assert-submaps - '({:row 1, :col 1, :level :error, :message "First arg of fn should be a symbol, arg vector or body list"}) + '({:row 1, :col 1, :level :error, :message "First arg of fn should be a symbol, params vector or arity clause"}) (lint! "(fn \"fn-name\" [x] (inc x))")) (assert-submaps - '({:row 1, :col 6, :level :error, :message "First arg of fn should be a symbol, arg vector or body list"}) + '({:row 1, :col 6, :level :error, :message "First arg of fn should be a symbol, params vector or arity clause"}) (lint! "(map (fn 'symbol ([x] (inc x))) coll)")) (assert-submaps - '({:row 1, :col 7, :level :error, :message "First arg of fn should be a symbol, arg vector or body list"}) + '({:row 1, :col 7, :level :error, :message "First arg of fn should be a symbol, params vector or arity clause"}) (lint! "(-> 7 (fn [x] (inc x)))")) (assert-submaps - '({:row 1, :col 7, :level :error, :message "First arg of fn should be a symbol, arg vector or body list"}) + '({:row 1, :col 7, :level :error, :message "First arg of fn should be a symbol, params vector or arity clause"}) (lint! "(-> 7 #(inc %))")) (assert-submaps - '({:row 1, :col 1, :level :error, :message "First arg of fn should be a symbol, arg vector or body list"}) + '({:row 1, :col 1, :level :error, :message "First arg of fn should be a symbol, params vector or arity clause"}) (lint! "(fn* :fn-name [x] (inc x))")) (are [lint-form] (empty? lint-form)