This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-02-29
Channels
- # announcements (6)
- # babashka (7)
- # beginners (24)
- # calva (2)
- # cider (21)
- # clj-kondo (49)
- # cljdoc (29)
- # clojure (56)
- # clojure-dev (2)
- # clojure-europe (15)
- # clojure-nl (6)
- # clojure-norway (27)
- # clojure-uk (3)
- # clojuredesign-podcast (6)
- # clojurescript (1)
- # conjure (1)
- # core-async (8)
- # cryogen (2)
- # cursive (6)
- # data-science (1)
- # datomic (12)
- # events (1)
- # fulcro (16)
- # graalvm (28)
- # hyperfiddle (2)
- # lambdaisland (4)
- # leiningen (20)
- # observability (1)
- # off-topic (24)
- # pathom (5)
- # pedestal (10)
- # portal (7)
- # practicalli (1)
- # reitit (5)
- # rewrite-clj (20)
- # shadow-cljs (18)
- # vim (8)
- # xtdb (9)
Quick q about guardrails: I have a clj CLI tool and I want to run guardrails even when the tool is packaged and in “production”. How do I do that?
Another q: if I define guardrails-export.edn
to exclude some namespaces for upstream users of my library, don’t I also disable guardrails for these NSs for my own dev of the library? Unless I explicitly clear exclusions whenever I start REPL?
In my statecharts lib, for example, I just put the toggles in my tests to ensure they are on all when my tests run. You could also add toggles to your “user” ns that is not on your export classpath so they always get turned off when your project loads in dev mode
There’s something very janky that would work.
(System/getProperty "user.dir")
=> "/Users/roklenarcic/clojure-projects/my-project"
(let [cl (.. Thread currentThread getContextClassLoader)]
(enumeration-seq (.getResources cl "guardrails-export.edn")))
=> (#object[java.net.URL 0x5924d5bd "file:/Users/roklenarcic/clojure-projects/my-project/src/guardrails-export.edn"])
So basically you can figure out which edn files are from subfolders of your work dir, which means you can ignore them, that would work provided you start your process so that the work dir is your project dir
usually the case
the rest of them are from dependencies
now obviously this is janky and might lead to suprises for some people who run their REPL differently
of course you can make this an explicit config option
hm. It’s not terrible. Could also look for entries that are coming from JAR files vs file files
True, but with new deps people can have dependencies in folder form in which case the entries will not be from jar
e.g. specifying the dep as a git coordinate will clone the repo and add the sources folder to classpath IIRC