This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-01-23
Channels
- # announcements (3)
- # architecture (10)
- # babashka (37)
- # beginners (69)
- # calva (2)
- # cider (10)
- # clerk (22)
- # clj-kondo (33)
- # cljdoc (44)
- # clojure (45)
- # clojure-conj (4)
- # clojure-denmark (7)
- # clojure-europe (14)
- # clojure-nl (1)
- # clojure-norway (5)
- # clojure-uk (4)
- # clojurescript (10)
- # clr (19)
- # conjure (1)
- # emacs (28)
- # events (1)
- # fulcro (1)
- # jobs (1)
- # joyride (1)
- # lsp (18)
- # malli (30)
- # membrane (3)
- # off-topic (23)
- # pathom (45)
- # portal (29)
- # proletarian (7)
- # rdf (15)
- # re-frame (21)
- # reagent (2)
- # releases (6)
- # remote-jobs (1)
- # reveal (6)
- # shadow-cljs (36)
- # slack-help (7)
- # sql (5)
- # tools-deps (3)
I'm assuming I must have some kind of syntax error, but I had turned off certain warnings in comment blocks, but one of them seems to be back. I have the following (excerpt):
:config-in-comment {:linters {:clojure-lsp/unused-public-var {:level :off}}}
But it does not seem to be working. A separate question is, when using clojure-lsp, and we make a config edit for clj-kondo, do we have to do anything to ensure that the config change has been picked up?So interestingly, if I run clj-kondo from the command line on the whole project, I don't get those errors emitted ... which suggests that maybe however clojure-lsp is running isn't finding my project's clj-kondo config? Hmmm.
This linter is implemented by clojure-lsp and doesn't work with :config-in-comment
at the moment
When I define a malli schema for a function and return an incorrect type in the function, clj-kondo does not complain as it would if I passed in an incorrect param for example. Is this expected?
@U04V15CAJ here is an example (I might be doing something wrong)
but returning an int
when the function spec says it is supposed to return string
seems to cause no issues
(defn welcome-string
{:malli/schema [:=> [:cat :int] :string]}
[name]
12)
(welcome-string "asd")
I think it will emit an error when you call welcome-string
and use its result as a non-string. The checking between the implementation and the actual spec might currently not be implemented yet
Yup, there is an error if you try to pass the result of the function (string) to inc (which wants a number) for example
Would be huge if the return expression in the function was also typed according to its spec though!
I imagine that would prevent lots of usual errors, like accidentally returning a higher-order function instead of a number, etc
@U04V15CAJ posted one here: https://github.com/clj-kondo/clj-kondo/issues/1973 (Sorry if I messed that up 😄)
Can you also please post some code in there to fully repro the situation? Preferably a github repo someone can clone. This will save the person who is going to implement this time.
Updated issue to add repro: https://github.com/zakkor/clj-kondo-schema-return-repro/blob/master/src/clj_kondo_schema_return_repro/core.clj Hope that helps
is there a tool out there that can auto-sort all of my project’s namespaces?
I am doing a big rename and 63 namespaces are now unsorted 🙂
❯ clojure-lsp clean-ns
[100%] Project analyzed
Checking namespaces...
Cleaned clojure.java.jdbc-test
Cleaned clojure.java.jdbc.spec
Cleaned clojure.java.jdbc.utilities-test
Cleaned clojure.java.jdbc
Cleaned clojure.java.jdbc.datafy
Cleared 5 namespaces
java.jdbc on master [!?] via ☕ v17.0.1 on ☁️ metabase-query took 5s
❯ pwd
/Users/dan/projects/clojure/java.jdbc
that is great
@U017QJZ9M7W You're not using clojure-lsp yet?
Not yet! Stuck in my old cider and kondo setup
Sounds like I need to make an upgrade
clojure-lsp has tasks to clean-ns, format code using cljfmt and get diagnostics using kondo, all in a single tool :)
clojure-lsp --help
lists:
> clean-ns Organize ns form, removing unused requires/refers/imports and sorting alphabetically.
amazing… docs for clojure-lsp also reminded me of cljfmt
clojure -Sdeps '{:deps {cljfmt/cljfmt {:mvn/version "0.9.2"}}}' -m cljfmt.main fix test
that got it done!