This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-12-02
Channels
- # adventofcode (153)
- # announcements (29)
- # architecture (6)
- # babashka (5)
- # beginners (197)
- # calva (71)
- # clj-kondo (27)
- # cljfx (4)
- # cljs-dev (33)
- # cljsrn (1)
- # clojure (52)
- # clojure-australia (5)
- # clojure-boston (1)
- # clojure-europe (38)
- # clojure-france (1)
- # clojure-hungary (5)
- # clojure-italy (1)
- # clojure-nl (19)
- # clojure-uk (5)
- # clojurescript (12)
- # conjure (4)
- # core-async (3)
- # cursive (22)
- # datalog (70)
- # datomic (32)
- # deps-new (8)
- # emacs (79)
- # events (2)
- # fulcro (15)
- # graalvm (15)
- # leiningen (2)
- # lsp (5)
- # minecraft (1)
- # nbb (1)
- # off-topic (37)
- # polylith (11)
- # re-frame (9)
- # reagent (1)
- # reitit (3)
- # releases (1)
- # reveal (2)
- # shadow-cljs (35)
- # spacemacs (1)
- # tools-build (4)
- # tools-deps (55)
- # vim (11)
- # xtdb (6)
Using GitlabCI, my lint job fails once in a while (not very often at all):
$ clj-kondo --parallel --lint src test
test/salus/server/fixtures/citizen.clj:66:29: error: Attempting to call unbound fn: #'hooks.salus.server/with-serializable-txn
What is odd is that there are other hooks defined in the same file, yet I only get this error for that particular one (last defined), and it's not systematic at all. Any idea?There was a bug once when you used --parallel
because the require stuff in SCI isn't thread-safe
Looks like it's still 2021.03.31
in the Nix env
When importing dependencies, do you have to import twice perhaps when your macros rely on files that haven't been cached yet?
The reason ns-analysis returns nil if the file hasn't been cached yet I gather. In any case, once I got dtype-next working correctly in its own project I moved to avclj, ran the --config --dependencies cmd to generate them and none of the imported definitions are present in the metadata.
removing the skip directory in the cache caused clj-kondo to re-run thus picking up the definitions that relied on ns-analysis to work. If I require the namespaces at the top level without an alias will that cause them to be linted before this namespace and thus cause the caching mechanism to work correctly the first time?
i have this in my .zshrc, @chris441
rekondo () {
rm -rf .clj-kondo/.cache/ && clj-kondo --lint "$(clojure -Spath)" --parallel
}
just as a really blunt "let's start all this again, shall weeee?" button
That is helpful but removing the entire cache won't work. I have macros that import definitons from other namespaces that rely on clj-kondo's ns-analysis api which itself relies on the file being cached already. If it is not -as is what happens on first run, then ns-analysis returns nil and the linter macro incorrectly fails to define the functions. If I run the linter, thus creating the data namespaces and then remove only the skip dir and run again it produces the right answer.
This also is causing clojure-lsp to fail to lint correctly so I need a more thorough fix I think.
@chris441 I agree that we should somehow improve this, at least within one library / dependency. Perhaps with a tools.namespace dependency like approach.
So far it hasn't been much of a problem, but with hooks that need pre-cached analysis it is.
However, this is another challenge. The cache is not read or written to while linting, this is only done at the very end.
but perhaps ns-analysis can be made so that it also reads from the in-memory results (so far)
@chris441 if you tell me how I can test this out with your project in the above issue, that would help
@borkdude - I really appreciate your support a lot but thinking this through I think a better design for my project is to use code generation to generate the api .clj files. Even if we work through these issues I still don't support Cursive and I feel like this is perhaps not worth changing clj-kondo for and no matter what would still get a partial result. So let's pause on this and I will investigate implementing code generation on top of the existing api files, just renamed. Perhaps it isn't necessary to solve this issue for this reason at this time.
We've recently created a stub library to create stubs for closed sources like the datomic API. This also helps clj-kondo. Cursive / IntelliJ has a similar approach.