Fork me on GitHub
#clj-kondo
<
2021-12-20
>
fabrao11:12:55

How do you use clj-kondo in ci process? Before testing or after? How do you invalidate the ci from any kondo condition?

borkdude12:12:19

There are various options. Some people configure their CI to fail if clj-kondo fails, other people just use it as a monitoring thing

serioga13:12:09

Hm, the idea behind :docstring-no-summary does not work for docstrings like

"Puts a diagnostic context value `v` as identified with the key `k`
   into the current thread's diagnostic context map.
   Returns a Closeable object who can remove key when close is called.
   The `k` cannot be null.
   If the `v` is null then nothing is put and noop Closeable returned."
I see that clojure.core also has many cases where summary sentence spans multiple lines...

borkdude13:12:01

@serioga makes sense. I'm open to receive improvements either from you, @joost-diepenmaat or anyone else.

serioga13:12:48

I guess it's a question to @joost-diepenmaat about concept of this linter 🙂 I like an idea in general but current implementation is not really useful for my codebase.

joost-diepenmaat13:12:41

I’m not surprised this linter triggers many warnings on “good” codebases. It’s pretty hard to summarize a function in a single short line. Personally I really like the style since it forces clarity and it’s part of the clojure style guide but it’s definitely not for everyone. Which is the reason the linter is off by default.

borkdude13:12:14

@joost-diepenmaat I think the issue is that not all sentences are on a first line because of how docstrings are formatted.

borkdude13:12:30

"Puts a diagnostic context value `v` as identified with the key `k`
   into the current thread's diagnostic context map.

joost-diepenmaat13:12:40

The problem is that the line is too long.

joost-diepenmaat13:12:39

At least that’s my interpretation. I would go with max -80 characters for a summary

joost-diepenmaat13:12:15

It’s intended that summaries fit on a single line on screen.

borkdude13:12:15

That's not really in line with how most clojure code looks and how emacs formats things. I guess this linter is pretty useless for most people if we keep it like this.

serioga13:12:49

For me the reference how to write docstrings is clojure.core. But most docstrings in clojure core will not pass this linter 🙂

☝️ 2
joost-diepenmaat13:12:54

We can take a look at what cider does with apropos. That lists the first sentence (not line)

joost-diepenmaat13:12:45

Would still recommend a short first sentence but fine by me to lift te restriction on newlines.

joost-diepenmaat13:12:37

I’m offline for a bit. Will be back later

👍 1
borkdude13:12:52

I guess it depends on the idea of "summary". The docstring posted by @serioga doesn't really have a summary, by the definition of the linter (currently).

borkdude13:12:38

so we should probably implement what is referred to in the style guide by @bozhidar

borkdude13:12:49

which is kind of ambigious

borkdude13:12:14

or not, I don't know.

borkdude13:12:22

I'll leave it up to you to decide

serioga13:12:44

Well, for me I see a useful linter that docstring starts from uppercase letter and ends with period, ignoring newlines.

borkdude13:12:40

the styleguide recommends placing the summary on a single line it seems. The next sentence should not begin on the same line for example.

serioga13:12:53

makes sense

borkdude13:12:25

ok, let's leave it like this then - sorry to bother you @joost-diepenmaat - a link to the style guide in linters.md would be good

bozhidar15:12:55

@borkdude The idea is simple - each docstring should start with a one-line sentence. This minimizes the work tools have to do to extract some meaningful summary of what a var does (and as a bonus - it plays great with the Emacs minibuffer, that happens to have a height of 1 line).

borkdude15:12:37

ok, this is the conclusive info we needed. we just need to update linters.md with it then

bozhidar15:12:43

Even more importantly - it's nice for humans to start with a short and clear summary and then expand on it if needed.

bozhidar15:12:12

You're welcome!