Replies: 2 comments 3 replies
-
Another interesting specimen: (defmacro check!
"Evaluates `x` and throws an exception with `anomaly` as data
if `x` does not evaluate to logical true." For me this docstring is perfect as-is. But is the docstring a "summary"? It can be considered both a summary of what it does (briefly and in one sentence), and a docstring without a summary at all (because it makes no summary/content distinction at all; a small defn doesn't really need it). I think that the right thing here is to be lenient in face of ambiguity, after all it's common to have clj-kondo as a hard CI check. Running this linter in a real-world codebase would raise hundreds of faults, which I don't find actually problematic to begin with. So it can be counterproductive to find most docstrings wrong, one would end up not enabling the linter at all. (Whereas I do see value in it) |
Beta Was this translation helpful? Give feedback.
-
This has been discussed in Clojurians Slack: https://clojurians.slack.com/archives/CHY97NXE2/p1640005869161800 The outcome of that discussion has been processed in linters.md: https://github.com/clj-kondo/clj-kondo/blob/master/doc/linters.md#docstring-no-summary |
Beta Was this translation helpful? Give feedback.
-
Hi,
is this string supposed to be OK per :docstring-no-summary?
https://github.com/bbatsov/clojure-style-guide/tree/b475d9e7e32c70b972f2d73e24ec790ea27bee22#docstring-summary says:
Let the first line in the docstring be a complete, capitalized sentence which concisely describes the var in question.
It can be hard to meet that while also meeting e.g. a 80 columns limit. So, satisfying multiple linters at the same time might be hard here.
Perhaps clj-kondo could try detecting line-wrapped summaries. My tentative thinking would be:
Good
Also good
Bad
WDYT?
Beta Was this translation helpful? Give feedback.
All reactions