Fork me on GitHub
#clj-kondo
<
2021-06-11
>
pedrorgirardi10:06:41

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 ( "clojure/core.clj"), but...I don't have a REPL. How would you do it?

pedrorgirardi10:06:14

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

borkdude10:06:23

The analysis includes the locations of files, right?

pedrorgirardi10:06:38

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

pedrorgirardi10:06:51

Not the full path.

pedrorgirardi10:06:55

Am I missing something?

pedrorgirardi10:06:08

Ohh,,this is great!

borkdude10:06:46

Welcome. Keep us posted about your cool project :)

pedrorgirardi10:06:32

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.

💯 3
pedrorgirardi10:06:02

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:

pedrorgirardi10:06:16

Is this the way to go?

borkdude10:06:47

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.

pedrorgirardi10:06:59

Right, I got you.

martinklepsch11:06:16

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

borkdude11:06:05

in general or one specific comment block?

Adam Helins11:06:55

or similarly, unresolved in (comment) ?

borkdude11:06:38

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

borkdude11:06:33

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.

borkdude12:06:51

@adam678 Your issue can be solved with:

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

💯 2
borkdude12:06:56

@martinklepsch Feel free to post an issue about this.

martinklepsch12:06:19

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

borkdude12:06:41

yeah, we could implement that as well

borkdude12:06:00

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

borkdude12:06:15

so comment is a bit of a special case

borkdude12:06:33

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

borkdude12:06:15

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

Matt Butler13:06:56

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

👋 2
Matt Butler14:06:02

Awesome, thanks man :)