Zulip Chat Archive
Stream: mathlib4
Topic: docBlame
Reid Barton (Dec 24 2022 at 18:45):
Can we tone down the docBlame linter a bit? It's pretty silly to document notation
, for instance
Reid Barton (Dec 24 2022 at 18:49):
In particular local notation
Mario Carneiro (Dec 24 2022 at 18:52):
You should generally be using @[inherit_doc]
on all notations, it's a bit rote right now
Reid Barton (Dec 24 2022 at 19:44):
I'm also skeptical of the value of documenting fields of structures. I see it makes sense in a programming context (where fields tend to have some meanings which cannot be determined from their names and types alone) but in a math context this rarely happens, especially when the fields are Prop-valued.
Reid Barton (Dec 24 2022 at 19:45):
It seems like we are enforcing the equivalent of
// add 1 to i
i++;
-style comments
Reid Barton (Dec 24 2022 at 19:46):
(Plus, during the port is the wrong time to add such comments)
Mario Carneiro (Dec 24 2022 at 19:51):
Regarding the last point, we still have nolints.json if you want to leave the documentation to someone else
Mario Carneiro (Dec 24 2022 at 19:53):
I'm generally skeptical of the claim that there are any statements that don't benefit from being written in english. Personally I would have the doc requirements much higher than they are currently are, basically one on every theorem, but I think that's too much to ask at this point.
Mario Carneiro (Dec 24 2022 at 19:54):
Even if occasionally you cheat and put some "add 1 to i" style comment some times, the overall effect on the library of passive "write anything at all, please" doc requirements is really massive
Reid Barton (Dec 24 2022 at 19:55):
To be clear, I think the documentation requirements are actively bad because they encourage poor documentation which tends to displace good documentation
Mario Carneiro (Dec 24 2022 at 19:56):
I don't think that not having doc requirements would somehow cause good docs to be written
Mario Carneiro (Dec 24 2022 at 19:56):
who's going to write those?
Mario Carneiro (Dec 24 2022 at 19:56):
Replacing bad docs with good are of course something we will accept
Mario Carneiro (Dec 24 2022 at 19:57):
so I don't think anyone's hand is being forced here
Reid Barton (Dec 24 2022 at 19:57):
If there is something nonobvious about a structure definition for example, it should usually be documented at the scope of the structure as a whole
Mario Carneiro (Dec 24 2022 at 19:57):
Okay, so do that
Mario Carneiro (Dec 24 2022 at 19:58):
the doc requirements on structure fields doesn't prevent you from writing that comment
Reid Barton (Dec 24 2022 at 19:58):
but then if you also have to document the fields individually, it is just 2x the noise to wade through
Reid Barton (Dec 24 2022 at 19:58):
Conversely, not requiring documentation on each field doesn't prevent you from taking that approach when it is appropriate (which it surely is sometimes)
Mario Carneiro (Dec 24 2022 at 19:58):
you can give the fields minimal comments if the doc on the structure is expansive, I think
Mario Carneiro (Dec 24 2022 at 19:59):
but this is not at all the problem we have in the library currently
Mario Carneiro (Dec 24 2022 at 19:59):
too much docs is a problem I wish we had
Mario Carneiro (Dec 24 2022 at 19:59):
but we are battling "way too few docs" here
Reid Barton (Dec 24 2022 at 19:59):
I would just use @[nolint docBlame]
, anything else is too much fuss.
Mario Carneiro (Dec 24 2022 at 20:00):
I think nolint docBlame is basically never appropriate, at least in the situation you have outlined
Reid Barton (Dec 24 2022 at 20:00):
In that case, I would never add a structure to mathlib.
Mario Carneiro (Dec 24 2022 at 20:00):
a nolint in the nolints file is fine, that's basically saying "someone else do it, I can't be bothered"
Mario Carneiro (Dec 24 2022 at 20:01):
but nolint docBlame
means "this field should not be documented" and that's just a bizarre thing to say
Mario Carneiro (Dec 24 2022 at 20:03):
if you find yourself in this situation I would encourage you to use nolints.json instead of @[nolint]
Eric Wieser (Dec 24 2022 at 22:07):
Only data fields need documentation, right?
Yaël Dillies (Dec 24 2022 at 22:09):
Not currently, because all fields are def
s.
Yaël Dillies (Dec 24 2022 at 22:10):
Mario Carneiro said:
who's going to write those?
I do bust doc blame nolints from time to time.
Eric Wieser (Dec 24 2022 at 22:14):
but
nolint docBlame
means "this field should not be documented" and that's just a bizarre thing to say
I take it to mean "a conscious choice was made not to document it"
Eric Wieser (Dec 24 2022 at 22:18):
To me, the nolints file is for new linters that were added without fixing all their findings, as this means we can start stopping new mistakes in PRs without fixing them everywhere else in HEAD first
Mario Carneiro (Dec 25 2022 at 00:31):
Eric Wieser said:
To me, the nolints file is for new linters that were added without fixing all their findings
In a sense, the new doc requirement on structure fields is that, since it immediately creates a huge number of violations in mathlib that will take time to work off
Mario Carneiro (Dec 25 2022 at 00:32):
it's making an existing lint stricter rather than adding a new lint but it works out basically the same
Eric Wieser (Dec 25 2022 at 00:40):
but
nolint docBlame
means "this field should not be documented" and that's just a bizarre thing to say
I think then we agree on the first half of this sentence modulo phrasing but disagree on the second
Mario Carneiro (Dec 25 2022 at 00:43):
To put it another way, a nolints.json
entry is a TODO, while a @[nolint]
attribute is a not-a-bug/wont-fix annotation
Mario Carneiro (Dec 25 2022 at 00:45):
if we want to use @[nolint]
to mean "I decided not to do it but someone else might want to consider doing it" then we need another syntax to indicate "this is intentional, talk to someone before you try to 'fix' this"
Eric Wieser (Dec 25 2022 at 00:54):
"talk to someone before you try to 'fix' this" sounds the same as "won't-fix" to me
Mario Carneiro (Dec 25 2022 at 01:27):
that's what I mean
Mario Carneiro (Dec 25 2022 at 01:27):
to me @[nolint]
means wontfix
Mario Carneiro (Dec 25 2022 at 01:29):
and using @[nolint docBlame]
for something other than wontfix seems misleading
Mario Carneiro (Dec 25 2022 at 01:29):
and wontfix on documentation is nonsensical, hence why I say @[nolint docBlame]
should never be used
Johan Commelin (Mar 09 2023 at 13:03):
The docBlame linter is complaining at
feat: port/RingTheory.Localization.Basic !4#2741
I thought we told it to not do that....
Matthew Ballard (Mar 09 2023 at 13:06):
It didn’t listen. I use inherit_doc
for the fields now.
Eric Wieser (Aug 14 2023 at 18:49):
Yaël Dillies said:
Not currently, because all fields are
def
s.
I've filed std4#217 for ignoring def
s that should be theorem
s. Is there a lean4 issue about the fact they are not theorems in the first place?
Eric Wieser (Sep 21 2023 at 14:03):
https://github.com/leanprover/std4/pull/269 tells Std not to lint proof fields of structures for docstrings
Last updated: Dec 20 2023 at 11:08 UTC