Fork me on GitHub
#clj-kondo
<
2020-04-26
>
borkdude09:04:31

Podcast about clj-kondo and other topics: https://www.therepl.net/

hindol10:04:05

What does this line #!/usr/bin/env clojure -Sdeps {:deps,{selmer,{:mvn/version,"1.12.17"},clj-kondo,{:mvn/version,"2020.04.05"}}} do? From clj-kondo.lsp/script/update-project.clj. I get a warning /usr/bin/env: 'clojure -Sdeps {:deps,{selmer,{:mvn/version,"1.12.17"},clj-kondo,{:mvn/version,"2020.04.05"}}}': No such file or directory because I don't think that's a valid shebang line.

borkdude10:04:28

@hindol.adhya That might be a difference between macOS and linux. on macOS a shebang can take arguments. But this is easily fixable.

borkdude10:04:56

@hindol.adhya Like this:

#!/bin/sh

#_(
   "exec" "bb" "$0" hello "$@"
   )

hindol10:04:39

Sure. A PR's coming your way. I thought creating a deps.edn in the same directory would fix it as well, but that didn't work.

borkdude10:04:06

hmm, why didn't it?

hindol11:04:42

At first glance, using clojure that way, it's downloading the deps but not building the classpath right.

Could not locate selmer/parser__init.class, selmer/parser.clj or selmer/parser.cljc on classpath.

hindol11:04:34

@borkdude How about just sed "s/{{version}}/$(cat vscode-extension/CLJ_KONDO_VERSION)/g" server/project.clj.template > server/project.clj? Should work on MacOS as well.

borkdude11:04:56

@hindol.adhya I pushed the fix for linux

hindol11:04:57

Still does not work on my system.

Syntax error (FileNotFoundException) compiling at (script/update-project.clj:1:1).
Could not locate selmer/parser__init.class, selmer/parser.clj or selmer/parser.cljc on classpath.
And no server/project.clj is created (I deleted the on from git).

borkdude11:04:25

@hindol.adhya How do you start the script?

hindol11:04:16

./script/build-server

hindol11:04:53

Okay, I was preparing a PR but good that you fixed it.

borkdude12:04:28

@hindol.adhya This works for me on Debian with commit 7f15c58512dd347cf9e537120a942d8aaf9e2861:

borkdude@vps1918:/tmp/clj-kondo.lsp$ script/build-server
openjdk version "1.8.0_212"
OpenJDK Runtime Environment (build 1.8.0_212-8u212-b01-1~deb9u1-b01)
OpenJDK 64-Bit Server VM (build 25.212-b01, mixed mode)
Generation version file: 2020.04.05 > ../vscode-extension/CLJ_KONDO_VERSION
Compiling clj-kondo.lsp-server.impl.server
Compiling clj-kondo.lsp-server.impl.version
Compiling clj-kondo.lsp-server.main
Created /tmp/clj-kondo.lsp/server/target/lsp-server-2020.04.05.jar
Created /tmp/clj-kondo.lsp/server/target/lsp-server-2020.04.05-standalone.jar

hindol12:04:58

I am on Ubuntu Focal under Windows WSL, but the WSL part should not matter. It works just like plain Linux.

hindol12:04:26

Installed clojure via Linuxbrew.

borkdude12:04:01

I tested it on a debian machine where I never ran this repo before and it worked the first time. I'm not sure why it doesn't work for you. Can you try deleting + cloning from scratch?

hindol13:04:12

Did work after cloning from scratch.

nonrecursive16:04:48

hi hi - i’m using and loving clj-kondo 🙂 i’m trying to disable the :unused-namespace linter from within a namespace without success, i’ve added {:clj-kondo/config ^:replace {:linters {:unused-namespace {:exclude ["."]}}}} as metadata. I’ve also tried {:clj-kondo/config ^:replace {:linters {:unused-namespace {:level :off}}}}. any idea of what would help?

borkdude16:04:21

Hi @nonrecursive - thanks and welcome.

borkdude16:04:54

@nonrecursive Can you post a repro of an entire (small) file, so we can talk about exactly the same code?

nonrecursive16:04:43

sure thing, thank you very much!

borkdude16:04:24

works like a charm over here. which version are you using?

borkdude16:04:37

btw, ^:replace isn't necessary here

👍 4
nonrecursive16:04:00

looks like i’m on v2019.12.14

borkdude16:04:24

please upgrade

borkdude16:04:27

also note that only namespaces required with an alias or refer are reported. so (:require [foo.specs]) is fine

nonrecursive16:04:49

looks like that did it!! so easy. thank you!

nonrecursive16:04:19

what i’m actually doing is creating a dev namespace with a lot of aliased namespaces pulled in to put them within easy reach

nonrecursive16:04:39

clj-kondo has seriously improved my programming life 🙇

💯 12
❤️ 20
hadils17:04:44

Hi! I like clj-kondo but I am having problems getting it to work with Cursive 2020.1 I followed the instructions but it still doesn't pop up the lint info when I hover. Any suggestions?

hadils17:04:40

BTW, this is an awesome tool! I work with Datomic Cloud and this will cut down on the number of deploys to get error messages.

borkdude17:04:35

@hadilsabbagh18 Cool. Did you also see the datalog linting? About Cursive: hmm, I don't know, how are you using it, via the filewatchers or LSP? Did you try turning it off and on again (seriously.. ;))?

hadils17:04:15

I am using the File Watchers. I restarted several times.

hadils17:04:27

Should I try LSP instead?

borkdude17:04:52

Worth a try, but still I think it should work. Maybe @timothypratley knows something

hadils17:04:31

Hi @timothypratley! I have problems using clj-kondo with Intellij Cursive 2020.1 with File Watchers. I have followed all the directions and nothing pops up when I hover over bad code. Any suggestions?

borkdude17:04:58

But you do see the squirlies?

hadils17:04:48

I don't see anything. I know it works because I ran clj-kondo on the command line.

borkdude17:04:28

Ah. Maybe a configuration error? Did you follow the instructions to the letter?

hadils17:04:18

Yes. I compared the screen on Github to the one on my IDE and they match. I did all the prep work with .clj-kondo in my directory and linting the classpath.

hadils17:04:38

But I wouldn't rule out a config error...

borkdude17:04:54

Maybe the plugin isn't activated in your Clojure file?

borkdude17:04:08

Do you also use Cursive?

hadils17:04:32

I have the Ultimate edition.

borkdude17:04:53

maybe make a screenshot of your current config? with advanced settings expanded

hadils17:04:27

I will, hold on a sec.

hadils17:04:41

My configuration

hadils18:04:20

Working directory is set to $FileDir$ btw.

borkdude18:04:59

Looks correct to me. Is clj-kondo on the path ?

hadils18:04:24

Let me check.

hadils18:04:38

Hmm, let me restart my computer and see what happens.

borkdude18:04:24

What OS are you on?

hadils18:04:53

MacOS. I just restarted and put the absolute path of clj-kondo in the setup. Let me see if that works...

hadils18:04:08

So it still doesn't work. What else should I try?

borkdude18:04:13

I'll try locally

borkdude18:04:30

hmm, I can't get it to work either. Strange!

borkdude18:04:45

Maybe try the LSP alternative then

borkdude18:04:16

Maybe it's an issue with the FileWatchers plugin. Can you maybe test it with something else they claim that should work?

hadils18:04:45

Ok, I'll try the LSP alternative.

hadils18:04:54

The File Watcher was a plugin...

hadils18:04:48

For 2020.1 Ultimate -- not built in.

hadils18:04:02

I'm going to set up LSP now.

hadils18:04:12

It's completely different on 2020.1 I will figure it out and document it.

hadils19:04:11

Sorry, I misunderstood the LSP instructions. They work now. I have clj-kondo working properly on my Intellij. No changes to docs are necessary. Thanks for your help!

borkdude19:04:32

it's a pity that the Filewatcher is not working anymore, but gladly there is another option

timothypratley19:04:38

Hi @hadilsabbagh18 I am glad you got got it working with LSP 🙂 Just FYI all I know is that 2020.1 no longer supports the FileWatchers plugin. I don’t know why and I hope if we just wait a bit longer that will be resolved. But there is not really much difference between LSP and FileWatchers, so you are probably best off just sticking with LSP 🙂

borkdude20:04:16

so it's a known issue?

hadils20:04:58

Thanks for the feedback @timothypratley. LSP is working fine for me now.

timothypratley20:04:45

@borkdude ah I’m a little confused to be honest 🙂 When I upgraded IntelliJ it said FileWatchers was unsupported, but now I just opened up and enabled them and they are working fine

timothypratley20:04:09

so FWIW the FileWatchers way works for me still on 2020.1

borkdude20:04:30

@timothypratley I just set up filewatchers in 2019.2 but it doesn't work for me anymore, if I follow the directions

borkdude20:04:06

I'll try 2020.1

timothypratley20:04:00

Can you check that they are “enabled”?

borkdude20:04:06

now my IntellliJ is very unstable after upgrading it.

timothypratley20:04:55

uh oh 🙂 that sounds bad…

borkdude20:04:06

I had to disable Cursive, because of some crash

borkdude20:04:32

Now it should work again.

borkdude20:04:53

but it doesn't

borkdude20:04:27

No warning:

borkdude20:04:34

I don't know enough about IntelliJ, I'm giving up on the FW for today, since my wife needs me now 😉

timothypratley20:04:17

:thumbsup: I think tomorrow I can try out a fresh VM and experiment, no ideas right now either sorry.

Adrian Smith15:04:33

honestly the filewatchers thing feels like a bit of a hack compared to using the lsp plugin anyway