This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-07-26
Channels
- # aws-lambda (15)
- # babashka (7)
- # beginners (124)
- # calva (7)
- # cider (19)
- # clj-kondo (26)
- # clojure (261)
- # clojure-australia (3)
- # clojure-dev (10)
- # clojure-europe (45)
- # clojure-nl (4)
- # clojure-uk (6)
- # clojurescript (10)
- # datomic (7)
- # depstar (7)
- # emacs (11)
- # fulcro (41)
- # graalvm (48)
- # helix (1)
- # honeysql (17)
- # inf-clojure (7)
- # introduce-yourself (3)
- # jackdaw (2)
- # lsp (36)
- # malli (2)
- # meander (2)
- # membrane (1)
- # missionary (11)
- # off-topic (17)
- # pathom (83)
- # polylith (15)
- # re-frame (31)
- # reagent (42)
- # sci (35)
- # shadow-cljs (13)
- # spacemacs (13)
- # sql (19)
- # timbre (3)
- # tools-deps (77)
$ cat test.clj
(ns test
(:require [clojure.pprint :as pp]))
(pp/pprint "foo")
(comment
(require 'clojure.pprint)
)
$ clj-kondo --lint test.clj
test.clj:7:13: warning: duplicate require of clojure.pprint
linting took 14ms, errors: 0, warnings: 1
I was a bit surprised by this.Not sure. IMO, commented code should be unchecked for any semantics unless explicitly asked for. Moreover, if I use ; (require ...)
or #_ (require ...)
instead then there is no complaint from clj-kondo. So, why for the (comment ...)
form? I can understand checking to see whether a (comment ...)
or #_ (...)
block parses, but no checks other than that.
Because people usually develop in comment
forms and it's useful to have linting there.
Thanks. I see that now. {:skip-comments true}
. I specifically looked before I posted, but missed it.
Is clj-kondo intentionally ignoring unused required namespaces that don’t use :as
or :refer
? This test I’ve added to clj-kondo.unused-namespace-test
passes, but shouldn’t it fail?
(deftest unused-namespace-simple
(testing "Ignore plain require"
(is (empty?
(lint! "(ns foo (:require [clojure.core.async]))"))))
(testing "Don't ignore"
(is (seq
(lint! "(ns foo (:require [clojure.core.async :as async]))")))))
the reason is that people can use this for requiring namespaces with side effects, e.g. loading multimethods or specs
Is there a way to configure this behavior, or maybe just a hint for what I can temporarily change in clj-kondo to enable it for some cleanup I’m doing?
I assume the extend-type
and extend-protocol
macros are not included in the "Clj-kondo only expands a selected set of macros from clojure.core and some popular community libraries."?
or rather: does clj-kondo
give any promises on how these macros (and their bodies) are linted?
@U0178V2SLAY Feel free to post an issue.
roger, will do
I think this case might be handled in the quick and dirty way: avoid false positives, but don't provide all the analysis
I hope that descriptive enough 🙂