This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # announcements (5)
- # aws (5)
- # aws-lambda (6)
- # babashka (6)
- # beginners (48)
- # calva (54)
- # clj-commons (12)
- # clj-kondo (39)
- # cljfx (3)
- # cljs-dev (11)
- # clojure (91)
- # clojure-europe (25)
- # clojure-uk (3)
- # clojurescript (16)
- # cursive (2)
- # data-oriented-programming (6)
- # datomic (8)
- # emacs (10)
- # events (3)
- # fulcro (2)
- # functionalprogramming (2)
- # graalvm (4)
- # graphql (2)
- # helix (1)
- # honeysql (4)
- # jobs (1)
- # malli (4)
- # nextjournal (21)
- # off-topic (5)
- # other-languages (4)
- # overtone (3)
- # reitit (17)
- # releases (2)
- # rewrite-clj (6)
- # ring (6)
- # shadow-cljs (37)
would there be a way to use clj-kondo to read clojure and sort of expand regular clojure the same way you do macro expand? Like (defn foo [x] x) (defn bar [x] (foo x)) -> expand "(foo x)" -> (defn bar [x] x)
cool, idea. something like "term rewrite" but in clojure such analyser have to take in account that
foo is not static value, it is a reference that can be redefined in runtime
Hi all! I just had a situation that caught me off guard. I had a test that should fail, but didn’t when running the tests from the command line (poly test in my case). The reason turned out to be that the namespace name of the test file did not match the file name. I was surprised that clj-kondo didn’t catch this. Do you think this would be a good linter to add to clj-kondo? I.e.: check whether the namespace name matches the filename + path of the file?
@stefan.van.den.oord Absolutely and there is already an issue for it. It might be a relatively easy one if you want to hack on it. https://github.com/clj-kondo/clj-kondo/issues/1240
@U04V15CAJ Could you jump-start me by telling roughly where I should add my code?
Somewhere here: https://github.com/clj-kondo/clj-kondo/blob/4495e9387733e891ee735d745fd0bcf92185d59c/src/clj_kondo/impl/analyzer/namespace.clj#L358
In the ctx is a key called
:file that you can use to compare to the name of the namespace
For the unit test I think it would be easiest to create a couple of test resource files that I then read in in the unit test, is that ok with you? (Just checking because this way of testing by reading actual files doesn’t seem to be used yet.)
@stefan.van.den.oord you can disable the linter for all of the other tests in test_utils
Yeah thanks, that’s indeed the strategy that I’m working on 🙂 I didn’t know about the base config there, that’s going to make it a lot easier, thanks! 🙂
Currently it will report the ones that don’t match the file name. I think that’s desired behaviour, do you agree @U04V15CAJ?
That does make the linter more complex of course. I’m not sure what the use case would be for this. You can always silence the warnings with comments in the file…
I’m calling it the day. 🛏️ There’s a few failing tests remaining that I have to look into, I will followup soon.
Re multiple ns forms: the question is I think: in cases where this occurs in real life, is it by accident or on purpose most of the time? I have never felt the need to have multiple ns forms in one file.
Not after disabling my linter in base test setup of course, but that’s why it made me think.
Now locally all tests are passing, but not in CI. Not sure what’s going on. But that will have to wait till tomorrow. Good night!
Tests are green! 🎉 https://github.com/clj-kondo/clj-kondo/pull/1596
gives the same warning to me, so your lint-as seems to be working :)
(->> '("Mike" "Tom" "Jerry") (map (fn [x] (count x))) (cond->> true (map str)))
sorry @U04V15CAJ, I was too eager and added a unnecessary lint-as statements for ?>>. There is no issue. Sorry.
For exported config (in our case marick/midge/config.edn) is it expected that we would add this to source control or gitignore it and let each user's computer generate it for them?
@danielcompton I prefer to check it into source control so everyone has the same consistent linting results