Fork me on GitHub
#clj-kondo
<
2020-04-21
>
hindol12:04:44

clj-kondo warns about unresolved symbols in macros,

(defmacro when-let*
  ([bindings & body]
   (if (seq bindings)
     `(when-let [~(first bindings) ~(second bindings)]
        (when-let* ~(drop 2 bindings) [email protected]))
     `(do [email protected]))))

(when-let* [x 1  ;; x unresolved
            y 2] ;; y unresolved
  ...)
Is this within the scope of clj-kondo?

borkdude12:04:14

@hindol.adhya You can use the :lint-as configuration here

hindol12:04:21

:clj-kondo/config goes to the ns defining the macro or the one using it?

borkdude12:04:39

using. just put :lint-as in .clj-kondo/config.edn

hindol12:04:28

If it were the ns defining it, the macro and the config for linting could be together. But in this case, will just use .clj-kondo/config.edn

borkdude12:04:19

that would only work if you would lint all the sources in your project including dependencies. clj-kondo is designed to be able to lint single files as well

hindol12:04:12

Yeah, that makes sense.

flefik12:04:07

Had some trouble installing clj-kondo today after following the instructions in the README. /usr/local/bin is not always writable, and there seems to be some race condition too in the installation script when running it against a temporary file.

~ % bash <(curl -s )            
Downloading  to /tmp
Moving /usr/local/bin/clj-kondo to /usr/local/bin/clj-kondo.old
mv: cannot move '/tmp/clj-kondo' to '/usr/local/bin/clj-kondo': Permission denied
~ % sudo bash <(curl -s )       
bash: /proc/self/fd/11: No such file or directory
~ % (23) Failed writing body
~ % curl  > install-clj-kondo.sh
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1992  100  1992    0     0  24292      0 --:--:-- --:--:-- --:--:-- 24000
~ % ./install-clj-kondo.sh 
zsh: permission denied: ./install-clj-kondo.sh
~ % chmod +x ./install-clj-kondo.sh
~ % sudo ./install-clj-kondo.sh
Downloading  to /tmp
Successfully installed clj-kondo in /usr/local/bin

borkdude13:04:26

@cfeckardt you can invoke it like this:

install [--dir <dir>] [--download-dir <download-dir>]
does that not work for you?

flefik15:04:29

i saved it to a file (install-clj-kondo.sh) then ran it as sudo and that worked

flefik15:04:51

but neither bash <(curl -s ) nor sudo bash <(curl -s ) worked.

flefik15:04:03

this was on ubuntu 19.04

borkdude15:04:03

ok, maybe updating the README to not use bash <(...) is a better idea then

flefik15:04:15

I think sudo and <() don’t play nice

flefik15:04:10

sudo bash -c "$(curl -s )"