Skip to content

Commit

Permalink
Update error message to refer to params & arity clause
Browse files Browse the repository at this point in the history
  • Loading branch information
tomdl89 committed Nov 24, 2023
1 parent e44e734 commit 6dac281
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion doc/linters.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:*

Expand Down
2 changes: 1 addition & 1 deletion src/clj_kondo/impl/analyzer.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
10 changes: 5 additions & 5 deletions test/clj_kondo/main_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 6dac281

Please sign in to comment.