This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-03-09
Channels
- # aws (51)
- # beginners (57)
- # calva (10)
- # chlorine-clover (7)
- # cider (20)
- # clj-kondo (55)
- # clojure (43)
- # clojure-europe (9)
- # clojure-italy (1)
- # clojure-nl (5)
- # clojure-spec (8)
- # clojure-uk (71)
- # clojurescript (33)
- # core-async (22)
- # cursive (20)
- # datomic (3)
- # emacs (8)
- # figwheel-main (8)
- # fulcro (13)
- # garden (2)
- # graalvm (60)
- # graphql (26)
- # jobs (6)
- # joker (6)
- # kaocha (2)
- # lambdaisland (5)
- # malli (36)
- # off-topic (9)
- # portkey (15)
- # re-frame (3)
- # reagent (25)
- # remote-jobs (4)
- # spacemacs (3)
- # sql (111)
- # tree-sitter (29)
- # uncomplicate (3)
- # xtdb (2)
👋 Is clj-kondo able to work with macros, that expect a binding vector. Here’s an example: https://github.com/clojure/java.jdbc/blob/2acbf2736a30634c9c75e6a1853e970ffa6bdbb4/src/main/clojure/clojure/java/jdbc.clj#L876 When I write:
(jdbc/with-db-connection [db some-db-spec] …)
clj-kondo complains tha db
is unresolved (`unresolved symbol db` )@sasho.popov You can probably use :lint-as {clojure.java.jdbc/with-db-connection clojure.core/with-open}
Michiel, is this a valid config?
{:lint-as {clojure.java.jdbc/with-db-connection clojure.core/with-open
clojure.java.jdbc/with-db-transaction clojure.core/with-open}}
Can someone remember that Clojure-Kit was suggest here by someone who made it work with clj-kondo?
For this code with reader conditionals clj-kondo warns about “namespace rum.core is required but never used” (which is actually used in line 21). How should I lint code with reader conditionals?
@serioga If the library is only used in clj or cljs you should put the require in a reader conditional
@serioga because (:require)
isn't valid? yeah, that's how it is. clj-kondo lints a .cljc file twice: once for .clj and once for .cljs
Does it mean we should create an issue? https://clojurians.slack.com/archives/CHY97NXE2/p1583781706101500
yes, it would be good to add an issue for that and it's pretty easy to fix. I'll make sure it gets into the next release
«luckily you can have multiple :require
clauses»
the namespace order is tested independently in every :require
?
@serioga what you can also do: #?(:cljs [rum.core :as rum] :clj [rum.core])
. clj-kondo will ignore namespaces that do not have an alias or referred vars
I'm thinking about what to do with code like
(:require
; systems
[app.app-system.service.app-config]
[app.app-system.service.hikari-data-source]
[app.app-system.service.immutant-web]
[app.app-system.service.mount]
[app.app-system.service.webapp-http-handler]
[app.app-system.task.database-migration]
; imports
[app.app-system.impl :as impl]
[app.lib.util.integrant :as ig-util]
[integrant.core :as ig])
«I'm assuming you are asking this because of the unsorted-required-namespaces linter» exactly
oh maybe this could be documented and captured inside a unit test so we can keep this behavior as it is
with multiple requires everything become clear
(ns app.lib.react.mount
(:require
[app.lib.react.component :as react-component]
[app.lib.util.transit :as transit])
#?(:clj
(:require
[clojure.string :as str])
:cljs
(:require
[rum.core :as rum])))
so every format has its own section which is easy to maintain.
https://clojurians.slack.com/archives/CHY97NXE2/p1583782598108900I also not aware, but:
• Cursive has option “Docstring fill width” with default value 80
• Cursive shows function documentation “as is” and long lines are not easy to read because of horizontal scroll
So I thought maybe there a rule expected to keep lines in width 🙂
this documentation format also shows docstrings as preformatted http://clojure.github.io/clojure/clojure.core-api.html
I'm hesitating to include this in clj-kondo because in general clj-kondo isn't concerned with formatting. it strips away all whitespace for example before it analyzes any code.
«it strips away all whitespace for example before it analyzes any code.» but not from docstrings I guess
yeah, I guess it could. make an issue and then we can think about it some more: what the warning and config should look like.
«doesn't it also matter how far the string is indented itself?» leading spaces are stripped as I know
Docstring width is fine until someone needs to paste a link in and tell the CI to go away for this one function.
@dominicm If you have useful feedback on that issue, you can post it here: https://github.com/borkdude/clj-kondo/issues/793