-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document reasoning for error or warning messages #9245
Comments
Make sense since #5953 is almost over now. |
I don't really understand this issue. I agree that some of the descriptions aren't as clear as they can be, but we have infrastructure in place to write those descriptions. We should just write them 😅 |
Seeing as that @Pierre-Sassoulas gave a 👍 I'm closing this. We can re-open if @eirnym sees a good reason to do so! |
This is a general/epic issue to critically review every single message. Some of them have reasoning, some don't. I highlighted a few to show an example and provided questions what I'd like to see covered in each of them. I could create the same issue for each article which is not readable, but in that case all of them would be closed "as spam". I agree, that you expect PRs, but in most cases I can't imagine the reasoning behind each issue, why rule works in that and not the other way. |
I'm on mobile so I can't craft the comment I planned. I think it's a duplicate of an issue I created to add a rational to the doc template (might link later). Basically modifying the template is actionable but making a doc's message better should be a direct PR proposal for this particular doc's message. |
I think such an issue doesn't really work: documentation can always be made clearer and they will never reach a state where they are "done" and we can tick them off the list. We'll always want to keep improving them.
Agreed. If there is a common problem, for example "links to this site are broken", we can open an issue about a group of pages but otherwise it would likely be considered spam.
I think we also might not want to go into that much detail. Behaviour changes and it is hard to keep documentation up to date. I would gladly discuss individual improvements in PRs but that should probably be on a case by case basis. Issues should lead to PRs, they should be actionable and solvable. I don't think keeping this issue open will lead to more PRs being opened or to a concentrated effort to improve our documentation. |
this is a standard what I'd like to see: https://typescript-eslint.io/rules/no-explicit-any/ and I don't see that #5953 goes any near that point |
Like I said above, please provide constructive specific feedback to which we can respond. We have "Examples", "Further reading" and "Resources". The other headers fall under our "Description". While I understand that the link you provide is much better than what most of our messages have I don't think our current system has anything that prevents you from fleshing out a specific page to be as detailed as those of |
Let's be more specific comparing given eslint-no-explicit-any page with for example too-few-public-methods. @DanielNoord, please reply if I understood you right and be more specific if not. Following comparison doesn't tell how to it in visually as it can be done in many ways depending on formatting language and/or tooling. I'll go through eslint page, comparing it to pylint's. Most of these points are commented in my original post in section
Note about Sphinx and ReStructuredText. Sphinx is a tool to take markup text in one format and then generate other format. I believe, @DanielNoord probably refer to limitations of ReStructuredText. Few years ago I started to use and moved all my documentation to AsciiDoc format as it gives me possibilities I need. ReStructuredText is good enough, but it not so flexible and not so extensible as AsciiDoc. As far as I know |
Even pylint stay with ReStructuredText, most of my points make sense for me and it's possible to increase standard level of pylint documentation. The only two design elements on eslint pages can't be represented in ReStructuredText are blocks on the top and example array. Each example can be separated out in a separate sections of some sort and in some cases additional notes should be added. |
Thanks for the detailed post! I'll reply to your comments.
I think that might be a nice suggestion. However, note that for all messages that are not enabled by default we already provide such instructions like here. For plugin checkers we also have this, see here. I'm -0 on adding this section to all messages that are turned on by default: I can see how disabling the message might warrant a section, but I feel like that might also just clutter the page. Why not add a link to the configuration explanation at the bottom of all pages?
This is not related to the documentation but a feature request. We already track it here #7438
This is very similar to the issue described above.
Again, not related to documentation but a feature request that is being tracked here #2293
We have infrastructure to have multi-directory examples. The issue linked above tracks adding at least one example for each message which is a nice and actionable issue.
Those can and are often documented. If not we have infrastructure to do so, see this page.
Again, something that can already be written down. Apparently we don't document this but there is no reason to make an issue for this.
A nice improvement, but I don't think we need additional infrastructure compared to the related links section we can already make such as here.
Same as above, I don't think we need a section for this currently as it fits in Related links.
Same as above, I don't think we need a section for this currently as it fits in Related links.
I was referring to Sphinx as we use it to render the code blocks. To make the code executeable Sphinx would need to make this a feature. There is https://pypi.org/project/sphinx-exec-directive/ but it serves a different purpose.
I think all of your suggestions "make sense", they just don't warrant this issue being kept open. Most of them can already be done in our infrastructure we just haven't found the volunteers to do so. The other stuff we already track in our issue tracker. Hopefully I have answered all your points, let me know if I missed any 😄 |
I did not find the issue I was talking about, it seems we have a pretty nice template atm : It's not 1:1 with eslint or ruff as Daniel said, but it's equivalent and relevant to what pylint features currently exists. If a new section should be added please open a new issue. The message description is currently often used to tell WHEN the message is raised instead of WHY, if you want to open an issue for that, listing what message's descriptions need to evolve would make the issue actionable (a kind of todo list). |
Current problem
Linter error have few examples of "good" and "bad" behaviour, but in almost all cases there's no explanation what is the problem, what is the reasoning behind this check and what are possible outcomes of "bad" behaviour. I use specific reports as an example, but the explanation of a problem is common for almost all sections in pylint checks.
To show off the problem I'll question a few warnings below. With additional explanation they could be reasonable to follow, but without this explanation and wording used they and many others are more controversial or it looks like an order for a programmer what to do. When I read standard library, I see that my code that is full of warnings looks way cleaner than the standard library. :)
C0115:
Documentation says: "Used when a class has no docstring. Even an empty class must have a docstring.". But why classes must have a docstring?
I understand that developers of this checker wanted to increase readability of the code and this is a good point.
C0103:
Documentation dictates, that I need to use
T
overType
suffix forTypeVar
For me personally
T
suffix likeA
orLP
prefixes in Windows Naming Convention. This is machine-readable, may be useful in some use cases, but not in python, where readability matters. I don't want to "unpack" this letters to make my code "clean".R0902, R0913 and similar:
it's not always possible to put everything into subclasses or sub-datatypes even you want to. Examples in documentation show situations where arguments could be well-structured, but it's not always a case.
The same with R0903, it shows what is "good" and what is "bad" and gives no explanation why do I need to do that.
There's a lot of situations where this rule doesn't work as intended. Some of them:
__call__
method for clarity or interface reasonsUse case examples of where this rule doesn't work as intended:
__getitem__
to retrieve the tartget.__setitem__
? because I need more parameters which breaks__setitem__
and__getitem__
contract.Desired solution
Additionally to the existing explanation what is "good" and what is "bad", I suggest to:
Additional context
No response
The text was updated successfully, but these errors were encountered: