Fork me on GitHub
#clj-kondo
<
2022-01-11
>
pfeodrippe02:01:36

[RESOLVED] Hi \o I'm trying to update my clj-kondo from the CLI and I'm having (it appears to be an GH issue, but letting here just FYI). But I'm able to download the zip from the releases page o/

$ ./install-clj-kondo
Downloading 
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
 "">
<html>
  <head>
    <title>503 Backend.max_conn reached</title>
  </head>
  <body>
    <h1>Error 503 Backend.max_conn reached</h1>
    <p>Backend.max_conn reached</p>
    <h3>Guru Mediation:</h3>
    <p>Details: cache-for8427-FOR 1641867116 4140388333</p>
    <hr>
    <p>Varnish cache server</p>
  </body>
</html>/clj-kondo-
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
 "">
<html>
  <head>
    <title>503 Backend.max_conn reached</title>
  </head>
  <body>
    <h1>Error 503 Backend.max_conn reached</h1>
    <p>Backend.max_conn reached</p>
    <h3>Guru Mediation:</h3>
    <p>Details: cache-for8427-FOR 1641867116 4140388333</p>
    <hr>
    <p>Varnish cache server</p>
  </body>
</html>-macos-amd64.zip to /tmp

borkdude10:01:04

Can't reproduce:

$ mkdir k
$ ./install-clj-kondo --dir k
Downloading  to /tmp
Successfully installed clj-kondo in k
Must be a Github hiccup

pfeodrippe14:01:24

Yes, thanks, I guess it was it, want me to delete the message?

borkdude14:01:52

It's fine

👍 1
pfeodrippe14:01:51

Does clj-kondo have a way to say that a :type-mismatch function type is closed? For example, instead of

{:arities {1 {:args [{:op :keys,
                      :req {:person-external-id :string}}],
              :ret {:op :keys,
                    :req {:name :string}}}}}
we would have something like
{:arities {1 {:args [{:op :keys,
                      :req {:person-external-id :string}}],
              :ret {:op :keys,
                    :closed true ;; <<--------------
                    :req {:name :string}}}}}
and the return could be used for stronger type inference. I have seen that there is https://github.com/clj-kondo/clj-kondo/issues/783, but it's just weakly related from where I see.

pfeodrippe14:01:33

I could help on it if needed o/ Just don't know where to start

borkdude14:01:09

It hasn't got this. I think we should first discuss if we want this before starting on an implementation. See https://github.com/clj-kondo/clj-kondo/blob/master/doc/dev.md#workflow

borkdude14:01:57

I think the related issue should be solved first before you would even benefit from this probably, but that you could explain in a Github Discussion or issue

pfeodrippe14:01:40

Yes, sure, I wouldn't start a PR without an issue o/ Thanks, so I will wait for the related issue to be resolved and I see what's needed from there (also it will give me more time to understand more of the clj-kondo codebase)

borkdude14:01:17

You could perhaps look into solutions(s) for the open issue. I haven't really investigated this myself yet

pfeodrippe14:01:51

Ok, nice, I will try to check it after this weekend (vacation). Is https://github.com/clj-kondo/clj-kondo/blob/d9fca2705863e3e604e004ccb942e0b3d2e268ec/src/clj_kondo/impl/types.clj#L318 a good place to start to look into this issue?

Mateusz Mazurczak21:01:33

Clj-kondo marks

(keep #(if (odd? %) %) (range 10))
as missing else branch, where it is okay to do it like this https://clojuredocs.org/clojure.core/keep#example-542692cfc026201cdc326e82 Also the problem I have with it is that the whole editor goes yellow. (screen below)

borkdude21:01:38

@mateusz.mazurczak.dev It is ok, but the style clj-kondo encourages is to use when if you don't have an else branch.

borkdude21:01:50

The yellow thing is something in the plugin, not something clj-kondo can fix. /cc @brcosta

👀 1
borkdude22:01:30

You can post an issue here about the yellow stuff: https://github.com/brcosta/clj-stuff-plugin

Mateusz Mazurczak22:01:06

Thanks for the response. I will report that. Also the errors stay the same for a long time unless I go and edit it more. So for example as you mentioned I changed if -> when. But the clj kondo still marks it as the previous error missing else branch. This happens often and is really annoying. Here is a recording of the issue: https://watch.screencastify.com/v/d65Ebva8KvLDIdUTJofr

brcosta22:01:21

Hi, thanks for reporting! I’m aware of the issues, just need some more time to fix them! Already have a proof of concept for the lag thing. About the missing branch going all yellow it’s the way Intellij highlights warnings, maybe I need to use another type of annotator for these cases, I’ll see. Again, thanks for reporting! 🙂

brcosta03:01:34

I just uploaded a fix for the performance issue, we need to wait for Jetbrains to approve it. If you want to test it sooner just DM me and I can send a prebuilt install package. About the yellow highlight I guess the easiest fix is to edit the default color scheme. If I have any other idea I let you know 😉

borkdude22:01:34

Please post that in the issue, I can't do anything about this. It's in the plugin.

borkdude22:01:06

It's helpful that you have the screencast though, for the plugin author to see what's going on.

borkdude22:01:50

I also noticed that lag and it's indeed annoying

Mateusz Mazurczak22:01:24

Yeah, spending minute on the error because you have whole screen yellow is pretty annoying

Mateusz Mazurczak22:01:06

Especially if some warning shows while writing code and stays after you finish

Mateusz Mazurczak22:01:41

Sorry, just ranting 😄

borkdude22:01:03

Try emacs until the issue is fixed ;-)

emacs 4
😅 1
Mateusz Mazurczak22:01:25

I recently switched to intelllj from emacs, maybe I will go back 😉

borkdude07:01:46

Can you try this one? Bruno fixed the lag but not yet the other problem

brcosta11:01:51

Good news, it’s already approved by Jetbrains, you can update directly in IDEA now