clj-kondo

https://github.com/clj-kondo/clj-kondo
serioga 2020-04-30T15:59:01.061Z

Hi @borkdude Looks like I cannot disable :unresolved-namespace linter using namespace meta.

(ns dev.playground
  {:clj-kondo/config {:linters {:unresolved-namespace {:level :off}}}})

(clojure.java.shell/sh "whoami")
> warning: Unresolved namespace clojure.java.shell. Are you missing a require? But the option works when placed in the main config.

borkdude 2020-04-30T16:00:35.061400Z

@serioga I also noticed that myself and created an issue for it: https://github.com/borkdude/clj-kondo/issues/870

1
borkdude 2020-04-30T16:00:51.061900Z

Follow up question: why would you like to turn it off?

serioga 2020-04-30T16:02:33.063200Z

I have a single file for experiments in my project. So I don't want to see warnings when I check whole project.

borkdude 2020-04-30T16:03:29.064500Z

@serioga You can also ignore that file with clj-kondo --lint "$(clj -Spath)" --config '{:output {:include-files ["^clojure/test"] :exclude-files ["tap"]}}'

serioga 2020-04-30T16:03:35.064700Z

Also I think it would be useful to be able to specify exact namespaces to ignore. Especially those which are preloaded using profiles.clj.

serioga 2020-04-30T16:04:46.065300Z

> You can also ignore that file not sure I want to ignore it completely when editing ๐Ÿ™‚

borkdude 2020-04-30T16:05:12.065800Z

ok, then you'll have to wait for #870 ๐Ÿ™‚

serioga 2020-04-30T16:05:26.066100Z

no problem ๐Ÿ™‚

serioga 2020-04-30T16:06:13.066400Z

> it would be useful to be able to specify exact namespaces to ignore what do you think about this?

borkdude 2020-04-30T16:06:34.066800Z

yeah, that makes sense

borkdude 2020-04-30T16:06:41.067Z

post it in another issue

borkdude 2020-04-30T16:07:07.067800Z

so far I didn't need that myself yet though

borkdude 2020-04-30T16:07:15.068200Z

can you give a good realistic example ?

serioga 2020-04-30T16:08:11.069300Z

especially this is annoying inside comment, where Cursive and clj-kondo cannot agree about used/unused namespace aliaces

borkdude 2020-04-30T16:08:30.069500Z

you can turn linting off in comment if you want

serioga 2020-04-30T16:09:12.069900Z

> can you give a good realistic example ? I'll prepare in the ticket

serioga 2020-04-30T16:10:05.070800Z

> turn linting off in comment also bad option, this helps to keep commented code in sync

borkdude 2020-04-30T16:11:27.071400Z

yes, I prefer to keep it on as well, but personally I don't have any conflicts with unresolved namespaces in comment sections

borkdude 2020-04-30T16:11:38.071700Z

so I'm curious about your example

serioga 2020-04-30T16:20:56.072900Z

Also maybe it would be useful to print linter ID with message. It's tricky to find exact configuration option from the message.

borkdude 2020-04-30T16:28:08.073500Z

@serioga you can also output as JSON or EDN, this will also print the name of the linter

borkdude 2020-04-30T16:28:24.073800Z

also, there's a link on config.md that points to all available linters

borkdude 2020-04-30T16:32:52.074700Z

Maybe there can be a setting to turn it on, I think I wouldn't like it by default

serioga 2020-04-30T16:33:34.075300Z

I know about config.md. But having message "Unresolved namespace" I cannot find this text there.

serioga 2020-04-30T16:33:58.075900Z

So for me the most reliable way it to dig into source code ๐Ÿ™‚

serioga 2020-04-30T16:35:27.076200Z

> you can also output as JSON or EDN and how to enable EDN output?

serioga 2020-04-30T16:36:06.076500Z

ah, found

serioga 2020-04-30T16:39:15.077200Z

> you can also output as JSON or EDN well, it's acceptable for debugging

borkdude 2020-04-30T16:45:39.077600Z

@serioga It is documented at the top of config.md how to find those names.

borkdude 2020-04-30T16:46:11.077900Z

It has a link to the source where all these keys are defined.

serioga 2020-04-30T17:19:36.080Z

@borkdude > It is documented at the top ofย config.mdย how to find those names. Can you point me to exact text? The use-case: I see a message warning: Unresolved namespace clojure.java.shell. Are you missing a require?. How can I find corresponding linter ID from config.md or linked configuration file?

borkdude 2020-04-30T17:29:20.080300Z

@serioga "Look at the default configuration for all available options." There is a link in that sentence

serioga 2020-04-30T17:30:48.081Z

Yes, it is liked to https://github.com/borkdude/clj-kondo/blob/master/src/clj_kondo/impl/config.clj But where is no text Unresolved namespace there!

serioga 2020-04-30T17:33:06.082200Z

My point is that I should guess linter ID from the message, but I cannot find exact text there, which is located in https://github.com/borkdude/clj-kondo/blob/36c0e7ce65521c0b7eb3a09c787ddf7e9b6d4219/src/clj_kondo/impl/linters.clj

serioga 2020-04-30T17:34:07.082800Z

But anyway I'm fine with EDN output as workaround

borkdude 2020-04-30T17:47:22.083Z

ok, cool

dominicm 2020-04-30T19:04:56.083100Z

I suppose the first person to get their funky macro shape into kondo wins. The trick is to identify a popular macro that doesn't work in kondo with any existing vars, and then name make a library with (defmacro dominic-rules) and then add that to kondo. Then when users of the popular library add the macro alias, they will add it as popular/library dominic-rules. ;)

๐Ÿ˜† 1
borkdude 2020-04-30T19:05:32.083300Z

๐Ÿ™‚