This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-04-07
Channels
- # announcements (1)
- # babashka (77)
- # beginners (219)
- # chlorine-clover (6)
- # cider (52)
- # clj-kondo (14)
- # cljdoc (5)
- # clojure (173)
- # clojure-europe (49)
- # clojure-finland (1)
- # clojure-germany (2)
- # clojure-italy (1)
- # clojure-nl (39)
- # clojure-sweden (4)
- # clojure-uk (51)
- # clojurescript (25)
- # code-reviews (9)
- # conjure (25)
- # data-science (2)
- # figwheel-main (6)
- # fulcro (74)
- # graalvm (1)
- # graphql (11)
- # jobs-discuss (17)
- # keechma (4)
- # lein-figwheel (4)
- # leiningen (1)
- # luminus (10)
- # malli (14)
- # mid-cities-meetup (2)
- # off-topic (28)
- # re-frame (5)
- # reagent (76)
- # reitit (30)
- # ring (7)
- # ring-swagger (1)
- # shadow-cljs (163)
- # spacemacs (11)
- # specter (2)
- # sql (43)
- # tools-deps (13)
- # vim (6)
- # yada (1)
In my projects, I get a lot of false positives for accessing private vars from tests.
Is there a neat trick to change lint rules between src
and test
?
@marc-omorain The way to get around this is to use #'foo/bar
instead of foo/bar
Nope, is regular Clojure. Looking deeper, it comes from using bond/with-stub
from https://github.com/circleci/bond
The #'
trick might work, I’ll check.
fwiw you can bind private vars in clojure: (binding [foo/*bar* 1] ...)
even if foo/*bar*
is private and clj-kondo knows about this, so linting as that one might work - although the syntax of your stubbing lib seems slightly different, so I'm not sure if that will work
@marc-omorain Another solution is to turn off the private linter locally:
(ns foo)
(def ^:private x 1)
x
(ns bar
{:clj-kondo/config {:linters {:private-call {:level :off}}}}
(:require foo))
foo/x
the linter is called :private-call
which should be renamed to :private-var-usage
or something in the future, but we will keep backwards compatibility
would have been easier if the with-stub macro syntax was exactly the same as binding
Thanks 🙏 I’ll take a look at those options.