This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-07-10
Channels
- # announcements (3)
- # beginners (67)
- # calva (4)
- # cider (3)
- # clj-kondo (58)
- # cljs-dev (4)
- # clojure (172)
- # clojure-berlin (4)
- # clojure-chicago (8)
- # clojure-europe (4)
- # clojure-greece (8)
- # clojure-italy (12)
- # clojure-nl (4)
- # clojure-spec (7)
- # clojure-uk (77)
- # clojurescript (13)
- # clojutre (16)
- # core-async (10)
- # cursive (3)
- # datomic (29)
- # figwheel-main (27)
- # fulcro (22)
- # garden (3)
- # jobs (2)
- # jobs-discuss (13)
- # juxt (5)
- # leiningen (14)
- # mount (4)
- # off-topic (28)
- # pathom (6)
- # pedestal (8)
- # portland-or (2)
- # re-frame (20)
- # remote-jobs (6)
- # shadow-cljs (13)
- # sql (74)
- # testing (17)
- # tools-deps (1)
- # vim (1)
- # xtdb (1)
It'd be interesting if clj-kondo could interpret metadata declarations and use them to control linting
I am running both joker and clj-kondo in spacemacs. There certainly is overlap between the two tools, and I am thinking of dropping joker. Do you think I will regret dropping joker?
@fiddlerwoaroof do you have an example?
If I have something like this:
(defn fun {:ignore-vars '[arg1 arg2]}
[arg1 arg2])
clj-kondo could supress warnings about arg1 and arg2 being unused.@lee I use a small wrapper script that turns off some joker features and I use that together with clj-kondo. I could share it if you want
@lee:
#!/usr/bin/env bash
## turn off some joker features, so I can test clj-kondo better
/usr/local/bin/joker "$@" 2>&1 \
| grep -v "unused" \
| grep -v "unsupported binding form" \
| grep -iv "unable to resolve symbol" \
| sed -e 's/$/ (joker)/'
exit 0
thanks! it might go well as a side-note in your docs where you talk about joker: https://github.com/borkdude/clj-kondo/blob/master/doc/editor-integration.md
well, it's kind of subjective what you want to suppress from joker, so it's not general advice, just how I happen to use it
@lee I'm fixing the quote-unquote bug right now. It results in a few less false positive while linting CLJS. e.g. here: https://github.com/clojure/clojurescript/blob/master/src/main/cljs/cljs/spec/alpha.cljc#L179 nice!
So maybe a blog post is better then. Personally I am only interested in heating from joker when it sees something that clj-kondo cannot see.
Have you seen: https://github.com/borkdude/clj-kondo/blob/master/doc/editor-integration.md#spacemacs
With joker you might also be able to use its config to turn some things off, but I found a wrapper script to be more flexible
@lee Here's a fix for MacOS for the quote-unquote issue: https://4422-176829714-gh.circle-artifacts.com/0/release/clj-kondo-2019.07.06-alpha-SNAPSHOT-macos-amd64.zip
so, that blog, if someone were to write it, might highlight what joker brings in addition to clj-kondo. As a newb, I’m currently unclear on that.
I think the most notable difference today is that joker is able to do some basic type checking on literals like (inc "string")
@borkdude, cljs compiler has a :fn-deprecated
warning. I fail my build if I use anything deprecated - except when I am calling my own deprecated fn from a deprecated function or am testing my own deprecated fns. My build is currently awkward/brittle when handling these exceptions. Do you have plans to add deprecated checking to clj-kondo?
cool! I think the clj only folks will probably find it useful too. I’ll try to get a git issue up today.
If I have something like this:
(defn fun {:ignore-vars '[arg1 arg2]}
[arg1 arg2])
clj-kondo could supress warnings about arg1 and arg2 being unused.@fiddlerwoaroof the way to solve that right now is to start the argument names with an underscore: (fn [_arg1 _arg2])
@lee fix for clojure.test is + are: https://4435-176829714-gh.circle-artifacts.com/0/release/clj-kondo-2019.07.06-alpha-SNAPSHOT-macos-amd64.zip
@borkdude cool, the other use I thought of was for describing the syntax of custom macros.
can you give an example? note that the config already supports a bunch of things for custom macros: https://github.com/borkdude/clj-kondo/blob/master/doc/config.md#lint-a-custom-macro-like-a-built-in-macro https://github.com/borkdude/clj-kondo/blob/master/doc/config.md#exclude-unresolved-symbols-from-being-reported
One thought would be something like this:
(defmacro deftest
{:clj-kondo/binds-globally '[test-name]}
[test-name & cases])
Then, when the macro is used, clj-kondo could add the value of test-name
to its dictionary of available names. I understand a lot of this can be done in the config file but I'd rather have the option to declare this stuff inline.
That is a little bit complicated, since clj-kondo might lint files where your deftest
macro is used, but it doesn't yet know about the macro itself. E.g. when using editor integration, you only lint one file at a time
Sure, but there's already something like that with the --cache
options?
e.g., IIUC, arity errors don't work correctly without a cache
clj-kondo can function correctly without a cache, but will just underreport arity errors when it doesn't know the arity of a called function with your example clj-kondo will overreport without a cache, something which I think is undesirable and hard to debug when users will report those false positives
also, so far my impression is that most users don't like tool-specific annotations inside their code. I have considered it at one point for e.g. https://github.com/borkdude/clj-kondo/issues/241, but when a solution arose that required no changes to the code, that was the preferred option
I'm not completely dismissing the idea and I've also experimented with a namespace local config for some linters
for testing, I sometimes use this:
(ns ^{:clj-kondo/config '{:lint-as {foo/foo clojure.core/def}}} foo)
(defmacro foo [_name & _body] ,,,)
(foo x)
(x 1)
it works, but it's undocumentedhey there @borkdude, I submitted the my first clj-kondo feature request https://github.com/borkdude/clj-kondo/issues/338