Fork me on GitHub
#clj-kondo
<
2022-12-13
>
Noah Bogart03:12:37

One of the things that linters in other language do is give each linter error a unique id so that errors can be easily searched and discovered. Has any thought been given to adding this to clj-kondo?

borkdude06:12:53

This can be enabled via config, see docs

borkdude06:12:54

On mobile now so can’t give you the link but it’s in config.md

Noah Bogart14:12:39

Thanks. I should have been more specific. Those are good for knowing the name of the linter, but they don't search well unless you're in the linters docs page and use "find in page"

borkdude14:12:44

yes, you get an id and you can search. isn't that what you described?

Noah Bogart14:12:45

I'm thinking something like Python's Flake8 rules: https://www.flake8rules.com/rules/E101.html

borkdude14:12:02

I prefer a name like :unused-binding over E101 to be honest

👍 1
Noah Bogart14:12:57

Here's an example of what I've run into:

borkdude14:12:01

So this is more about SEO

Noah Bogart14:12:08

yes. folks in my org have come to me saying, "i'm getting this error and googling it doesn't tell me what's wrong" so i have to say "go to the docs/linters.md file and search it there" which works but is less direct than imo is necessary

Noah Bogart14:12:26

Maybe this is just something that would be helped by having a stand alone clj-kondo website, with a single page per linter. that's a lot of work lol just trying to think through it

borkdude14:12:37

well, it's unfortunate that google doesn't find unused binding -> linters.md ;)

borkdude14:12:00

Maybe we could enable showing the name by default

borkdude14:12:12

but this wouldn't solve the SEO problem

borkdude14:12:31

Perhaps it would help if we generated an HTML page like this: https://book.babashka.org/ I'm not sure if it's Github README vs HTML or something else

👍 1
Noah Bogart14:12:17

Yeah, sadly not. This isn't a requirement, of course, for example eslint doesn't use "unique ids" that are letters and numbers (https://eslint.org/docs/latest/rules/no-await-in-loop), neither does rubocop (https://docs.rubocop.org/rubocop/cops_lint.html#lintbooleansymbol), but those both have stand-alone websites that might help in this regard

Noah Bogart14:12:36

Just in case, I hope I don't sound like I'm demanding you build a whole new website for this, lol. If this is something you're interested in, I'm willing to put in work as well. (For example, https://github.com/clj-kondo/clj-kondo/pull/1805 from back in September.)

borkdude14:12:53

can you do a couple of searches for words in http://book.babashka.org to see if they show up properly in google?

borkdude14:12:14

I've done a poll recently about what people prefer: mkdocs material / antora vs the http://book.babashka.org there is now. People vastly preferred the single page that there is now. I've thought about moving clj-kondo docs to asciidoc and then using the same http://book.babashka.org layout (single page). It'd be good to see if this helps SEO too

Noah Bogart14:12:35

each of this points to the book site but doesn't point to the specific part of the page. frustrating

borkdude14:12:51

well, at least it shows up

borkdude14:12:04

google sometimes does send you to some context on a website right

borkdude14:12:58

well, at least you can do ctrl-f after you end up there after google

👍 1
borkdude14:12:21

why are .md pages on Github not indexed that well then?

borkdude14:12:10

This seems pretty good

👍 1
Noah Bogart14:12:13

i mentioned eslint and rubocop earlier. eslint has specific pages for each rule while rubocop does not. "eslint no-await-in-loop" points to the specific linter page, while "rubocop lint/booleansymbol" points to the "lint cops" page (that contains all of the lint rules)

borkdude14:12:01

Well, I think people need at least to know about config.md and linters.md to get going and maybe they should just ... read some docs?

👍 1
Noah Bogart14:12:12

seems this is just how google indexes things then, and is not a game we should fall into playing lmao. if it's smart for clj-kondo's workflow to have individual pages then do it, but don't do it merely for the seo

Noah Bogart14:12:53

Agreed. I do think that a "clj-kondo book" like the babashka one would be overall helpful, but I don't think doing more than that is necessary

borkdude14:12:07

cool, I was already planning on doing that

Noah Bogart14:12:17

thanks for talking with me about this! i appreciate it

❤️ 1
borkdude14:12:34

if you want to help out, feel free to "port" the docs to asciidoc (I used pandoc for this with bb) and then set something up (using the same stuff as babashka, asciidoctor) that generates an HTML page. Only if you want, no pressure

Noah Bogart14:12:00

I'll see if I can scrounge up some time to give that a try! sounds like fun

borkdude14:12:15

the babashka book stuff lives here: https://github.com/babashka/book

borkdude14:12:35

but I think for clj-kondo I'd like the docs stuff to just live in the clj-kondo repo itself still

borkdude14:12:49

feel free to to put something up in a separate repo

serioga15:12:44

The link to the docs should be shown along with error message :-)

niwinz11:12:35

Is this a known issue?: a unused require warning when used in CLJC file and the require is used only on CLJ part of code? I have tried the v2022.12.10 version and still hapens to us.

1
frankitox12:12:11

Just in case, have you tried running clj-kondo without the cache? rm -r .clj-kondo/.cache

borkdude12:12:55

Yes, this is standard behavior. if you're only using the namespace in one "target" you should wrap it in a reader conditional.

borkdude12:12:26

else it would be quite wasteful to include namespaces in a clojurescript bundle that aren't used right

borkdude12:12:03

There is an issue to clarify the message that it only applies to one target

niwinz12:12:34

the case is: i have a function that uses a macro in :clj condition but does not uses it on :cljs

niwinz12:12:32

I'm not using it in both because the underlying implementation is different, and one raises exceptions and the other no, so this is a legitimate use in my opinion

borkdude12:12:46

can you make a full repro, in order for me to understand and give you better help?

borkdude12:12:58

in the form of a .cljc file that I can lint locally

niwinz12:12:14

If this not makes it clear, I can try to make a little repro

niwinz12:12:47

the ex/ignoring is a macro that just ignores exception and returns nil, it is used in one target but not in other

borkdude12:12:34

so what happens if you do (:require #?(:clj [ex.ignoring :as ex]))?

niwinz12:12:11

you mean include the require also in the condition, hmm, you right, I have not considered it :S

niwinz12:12:16

ok, so sorry for this dumb quiestion then. didn't considered this obvious solution

borkdude12:12:22

no problem :)