Skip to content

Commit

Permalink
Merge branch 'master' into if-nil-return
Browse files Browse the repository at this point in the history
  • Loading branch information
borkdude authored Dec 12, 2024
2 parents 74fbd44 + 2bedcd5 commit 5ebc1f0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ For a list of breaking changes, check [here](#breaking-changes).
## Unreleased

- [#2272](https://github.com/clj-kondo/clj-kondo/issues/2451): Lint for nil return from if-like forms
- Add `printf` to vars linted by `analyze-format`. ([@tomdl89](https://github.com/tomdl89))
- [#2272](https://github.com/clj-kondo/clj-kondo/issues/2272): Report var usage in `if-let` etc condition as always truthy
- [#2272](https://github.com/clj-kondo/clj-kondo/issues/2272): Report var usage in `if-not` condition as always truthy
- [#2433](https://github.com/clj-kondo/clj-kondo/issues/2433): false positive redundant ignore with hook
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 @@ -2475,7 +2475,7 @@
this-as (analyze-this-as ctx expr)
memfn (analyze-memfn ctx expr)
empty? (analyze-empty? ctx expr)
format (analyze-format ctx expr)
(format printf) (analyze-format ctx expr)
(use require)
(if top-level? (namespace-analyzer/analyze-require ctx expr)
(analyze-children ctx children))
Expand Down
3 changes: 3 additions & 0 deletions test/clj_kondo/format_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
(assert-submaps
'({:file "<stdin>", :row 1, :col 68, :level :error, :message "Format string expects 1 arguments instead of 2."})
(lint! "(require '[clojure.tools.logging :as l]) (l/errorf (ex-info \"\" {}) \"%s\" 1 2)"))
(assert-submaps
'({:file "<stdin>", :row 1, :col 9, :level :error, :message "Format string expects 2 arguments instead of 1."})
(lint! "(printf \"%s %s\" 1)"))
(is (empty? (lint! "(format \"%3$s\" 1 2 3)")))
(is (empty? (lint! "(format \"%3$s %s %s %s\" 1 2 3)")))
(is (empty? (lint! "(format \"%3$s %s %s %s %s\" 1 2 3 4)")))
Expand Down

0 comments on commit 5ebc1f0

Please sign in to comment.