This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # announcements (1)
- # babashka (3)
- # beginners (48)
- # calva (1)
- # clj-kondo (1)
- # cljs-dev (6)
- # clojure (29)
- # clojure-europe (15)
- # clojure-spec (1)
- # clojure-uk (8)
- # clojurescript (17)
- # conjure (23)
- # css (7)
- # cursive (16)
- # datascript (1)
- # emacs (4)
- # fulcro (32)
- # hoplon (3)
- # keechma (16)
- # leiningen (1)
- # luminus (1)
- # meander (11)
- # off-topic (18)
- # pathom (15)
- # re-frame (12)
- # reagent (12)
- # reitit (5)
- # reveal (5)
- # spacemacs (5)
- # xtdb (18)
Is anyone aware of a tool that checks all your project's publics and report any functions that have no docstring or spec definition?
I think you can write a script/function to iterate over all namespaces
(all-ns), find the publics
(ns-publics) and check if there's a spec for it
That will also work for docstrings btw, you can check meta. But clj-kondo reports it while you're typing.
Yeah it doesn't sound too difficult to implement. But if it already existed I might as well use that. I'll take a look at the spec implementation. Thanks!
@kevin.van.rooijen Quick repl session:
$ clj Clojure 1.10.1 user=> (require '[clojure.spec.alpha :as s]) nil user=> (s/fdef user/foo :args (s/cat :i int?)) user/foo user=> (defn foo [x]) #'user/foo user=> (defn bar ) #'user/bar user=> (doseq [[_ v] (ns-publics *ns*)] (when-not (s/get-spec (symbol (str (ns-name *ns*)) (str (:name (meta v))))) (prn "No spec for" v))) "No spec for" #'user/bar nil
Note that you might have to exclude non-function vars, but that can be done by checking
:arglists on the meta of the var possibly
I just debugged some code and figured out that there is no conversion available for
(https://github.com/clojure/clojure/blob/master/src/clj/clojure/java/io.clj#L44) I wonder what I am missing here. That basically means we can never use Path with http://clojure.io?
Everything in in http://clojure.java.io predates the existence of Path
Having done a lot of Java file stuff lately, it’s a little frustrating how often you need to convert between file and path to use different apis
I think it's more the other way around. java.nio. is the new API which has more capabilities than the old one. For me it was not even about functionality. I just stumbled upon code that tried to call
(io/file ... on a
java.nio.file.Path object which it cannot convert. This is one of these so called *surprise things where an API does things that you would not expect it to. Or better, I would have expected it to work, given that it is partof the JDK since 1.7.
Did you used to have [raynes/fs](https://github.com/Raynes/fs/) on the classpath somewhere?
Shame that isn’t baked into core, especially as Clojure 1.10+ dropped support for JVMs that lack
Would it be possible to make a clojure.core/for version of a transducer? I have no actual need for this. It just occurred to me watching the clojure North video on prolog