clj-kondo

https://github.com/clj-kondo/clj-kondo
pedrorgirardi 2021-06-11T10:40:41.203100Z

I'm slowly building my Clojure setup on Sublime Text based on clj-kondo and it's been a super fun experience! But since I'm doing everything based on the analysis output, I don't have a REPL to do anything, and now I'm wondering how to get the location of a file which is in my classpath e.g.: clojure/core.clj. In a Clojure REPL we could (<http://clojure.java.io/resource|clojure.java.io/resource> "clojure/core.clj"), but...I don't have a REPL. How would you do it?

pedrorgirardi 2021-06-11T10:42:14.204200Z

I need to know the path of the file so I can implement a Go to... type of thing.

borkdude 2021-06-11T10:42:23.204500Z

The analysis includes the locations of files, right?

pedrorgirardi 2021-06-11T10:42:38.204700Z

This 'filename': 'clojure/core.clj',

pedrorgirardi 2021-06-11T10:42:51.205100Z

Not the full path.

pedrorgirardi 2021-06-11T10:42:55.205300Z

Am I missing something?

pedrorgirardi 2021-06-11T10:43:16.205400Z

pedrorgirardi 2021-06-11T10:45:08.206600Z

Ohh,,this is great!

pedrorgirardi 2021-06-11T10:45:19.206900Z

Thanks @borkdude!

borkdude 2021-06-11T10:45:46.207400Z

Welcome. Keep us posted about your cool project :)

pedrorgirardi 2021-06-11T10:50:32.212100Z

It's amazing what you can do based on clj-kondo's analysis output. It's really good! 🙂 I started working on this for myself, I would like to use Sublime Text to program in Clojure, but maybe it could be something others could use too. It's very early days still, so we will see.

💯 1
pedrorgirardi 2021-06-11T10:53:02.213700Z

Another question. I do the initial setup to create a clj-kondo cache and all. But then, I have a Sublime Text command to analyze the classpath which I use to "index" var definitions & usages. I'm currently running with these options whenever I want to analyze the classpath:

pedrorgirardi 2021-06-11T10:53:06.213800Z

pedrorgirardi 2021-06-11T10:53:12.214200Z

(It's Python)

pedrorgirardi 2021-06-11T10:53:16.214400Z

Is this the way to go?

borkdude 2021-06-11T10:55:47.215Z

yes, that looks good. if you analyze everything, you don't have to do anything else before it, except to create a .clj-kondo directory.

pedrorgirardi 2021-06-11T10:57:59.215300Z

Right, I got you.

martinklepsch 2021-06-11T11:31:16.215700Z

is there a way to disable redefined-var warnings inside comment blocks?

borkdude 2021-06-11T11:50:05.216Z

in general or one specific comment block?

martinklepsch 2021-06-11T11:50:14.216200Z

in general

Helins 2021-06-11T11:52:55.216700Z

or similarly, unresolved in (comment) ?

borkdude 2021-06-11T11:53:38.217200Z

you can turn off all linting in comment forms with {:skip-comments true}

borkdude 2021-06-11T11:56:33.217900Z

Perhaps we should disable the redefined-var linter in the comment form by default as I can't come up with a reason why this would be unreasonable to do.

borkdude 2021-06-11T12:04:51.219100Z

@adam678 Your issue can be solved with:

$ clj-kondo --config '{:linters {:unresolved-symbol {:exclude [(clojure.core/comment)]}}}' --lint - &lt;&lt;&lt; '(comment a b)'
linting took 11ms, errors: 0, warnings: 0

💯 1
borkdude 2021-06-11T12:05:56.219400Z

@martinklepsch Feel free to post an issue about this.

martinklepsch 2021-06-11T12:07:19.219700Z

@borkdude wouldn’t the approach above work for redefined var too?

borkdude 2021-06-11T12:07:41.220Z

yeah, we could implement that as well

borkdude 2021-06-11T12:08:00.220500Z

but it's a bit weird to do this for vars, since they are usually defined top level and not inside some other call

borkdude 2021-06-11T12:08:15.220800Z

so comment is a bit of a special case

borkdude 2021-06-11T12:09:33.221200Z

let's just make an issue for it and then think about the right config later

borkdude 2021-06-11T12:10:15.221700Z

I would be fine with just disabling the redefined var linter inside comment blocks

martinklepsch 2021-06-11T12:11:27.221900Z

👍 https://github.com/clj-kondo/clj-kondo/issues/1294

Matt Butler 2021-06-11T13:27:56.223100Z

Hey, everyone 🙂 Sorry if I've missed it, but is there a way to blanket ignore a namespace?

👋 1
Matt Butler 2021-06-11T14:07:02.223700Z

Awesome, thanks man :)