This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-04-10
Channels
- # announcements (2)
- # babashka (20)
- # beginners (381)
- # calva (16)
- # chlorine-clover (21)
- # cider (1)
- # clj-kondo (18)
- # cljs-dev (107)
- # cljsrn (2)
- # clojure (161)
- # clojure-dev (5)
- # clojure-europe (2)
- # clojure-losangeles (3)
- # clojure-nl (3)
- # clojure-uk (35)
- # clojurescript (22)
- # conjure (48)
- # cursive (8)
- # datascript (11)
- # datomic (6)
- # figwheel-main (10)
- # fulcro (85)
- # hoplon (112)
- # jobs (1)
- # kaocha (5)
- # luminus (5)
- # malli (1)
- # off-topic (96)
- # onyx (1)
- # pedestal (1)
- # perun (1)
- # reagent (5)
- # reitit (1)
- # shadow-cljs (34)
- # specmonstah (1)
- # sql (6)
- # tools-deps (3)
- # xtdb (23)
I'm looking to build something that enforces specs on data|functions via lsp, do you know if there's a good library in Clojure for LSP? I can see clojure-lsp is using org.eclipse.lsp4j under the hood I can't work out what kondo-clj is using
@sfyire that code is here. it's based on how clojure-lsp is using the lsp4j library: https://github.com/borkdude/clj-kondo.lsp/tree/master/server
ah cool ty
Does this make sense? Automatically shutting off the unresolved symbol linter in macros? I'm playing with the idea, but it has pros and cons maybe.
It's a bit of a sledgehammer... I don't think I'd want it to be the default?
@borkdude This is puzzling -- I have the following import:
(:import (org.apache.oltu.jose.jws
JWS$Builder
signature.impl.SymmetricKeyImpl
signature.impl.SignatureMethodsHMAC256Impl)))
and these two functions:
(defn signer [] (SignatureMethodsHMAC256Impl.))
(defn symkey [k] (SymmetricKeyImpl. k))
but clj-kondo
flags the signature.impl
imports as being unused.If I change the import to this, it no longer flags them:
(:import (org.apache.oltu.jose.jws JWS$Builder)
(org.apache.oltu.jose.jws.signature.impl
SymmetricKeyImpl
SignatureMethodsHMAC256Impl)))
Nah, I'm going to bow to clj-kondo
's limitation here because nested imports are less readable (and it's already discouraged for requires).
clj-kondo apparently doesn't understand that nested import syntax (unlike nested namespace requires, which are discouraged in some style guides). I think I encountered this in tools.reader once and @bronsa's reaction was this: https://github.com/clojure/tools.reader/commit/97d5dac9f5e7c04d8fe6c4a52cd77d6ced560d76
Yup, that's basically what I did to that code that was reporting the problem 🙂 It's probably clearer than what I had before anyway.
I guess clj-kondo could add support for it, but I haven't seen it a lot myself out there
Re: the macro sledgehammer idea: https://clojurians.slack.com/archives/CHY97NXE2/p1586536435275900
I tried implementing a linter which reports when you use a macro as a value. like (filter when [1 2 3])
, but it resulted in quite a lot of false positives since you can pass any symbol to macros without it being resolved as vars.
So I thought it would be useful to capture at least what all used macros in a code base are named so it can be used to suppress certain things