-
-
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
Create separate documentation page for each message #5396
Create separate documentation page for each message #5396
Conversation
Pull Request Test Coverage Report for Build 1758434731
π - Coveralls |
Did you know about https://github.com/vald-phoenix/pylint-errors ? Pretty cool project even if incomplete. Result : https://vald-phoenix.github.io/pylint-errors/plerr/errors/basic/C0102. Often it's the first result when searching for a particular message. @DanielNoord What would you think about integrating this seriously in this MR ? @vald-phoenix what is your opinion about being integrated in pylint directly ? |
I think there are certainly benefits to be achieved when we can combine the two! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some notes, although I didn't review the PR.
- I'm not sure that it makes sense to create separate pages for the different message categories. As a user I would much rather prefer one long list (maybe with sections) that contains all. Then use
search
to find the one I'm looking for. - This PR does not change it so it can be ignored. I just wanted to mentioned that it probably makes sense to keep the old pages around. That way we don't invalidate existing links.
- I would also recommend some more discussion about the link template for individual messages. It would be good to get them right the first time as they will be difficult to change later. Some things to consider
- What if we rename the message? It should probably be accessible via the old and new one.
- If the id is used, what if that changes?
- Should the checker name be part of the url template?
- Does it make sense for the severity to be part of it?
- I like the use of a custom
sphinx
extension. I believe I've previously seen code related to how settings and error message are displayed in the docs directly in pylint. That might be something to look into when it comes time to refactor those areas. Moving them to an extension as well could be beneficial.
I will change this.
π
Can we make redirects in
This would require us to mark id's as being used even if they have changed. I don't think we currently store that information, we only store the name for
I don't think so? Even more things to keep track of when deprecating or changing stuff. Normally as user doesn't know which checker class emitted a warning anyway. I included it mostly for development purposes.
I'm not sure. Would it give users much more information besides what they currently have? I don't think it will help them with finding the page quicker than they can now, but it won't allow us to easily change the severity of messages. Including it on the page itself, rather than only as part of the id is something we could do though.
There are two other extensions, although they are not as large as this one. I hope with the move to |
We can but it's manual and I'd rather not have to do manual configuration for each name change.
I don't understand the question, if an id existed at any point, it's a current ID or an old names, so 'id' are always "used" once they are added to pylint.
Let's keep this simple for us so we can move messages around internally if we need to for perfirmance as well as cleanliness. Some issues are super hard to fix because of messages being mixed together, we need to be able to burst the checkers (#4574)
π Regarding the template I like what @pheanex did here : https://pheanex.github.io/pylint/#R1705 I think it's the basis for https://github.com/vald-phoenix/pylint-errors too. I think we can add old_names handling to it and the work intensive part will be a proper description for all message. @vald-phoenix how would you feel if we take the current content of your repository for a start ? |
Can't we pass it to
Ah, I forgot id's are also stored in old names. That would solve this problem as we can just make it part of the redirect (if we can make it work).
I'm not sure how easy it would be to transform those |
Wild idea, but maybe we could take the good example / bad example from functional tests and convert it to Ie: having a
The The |
I like the idea but think it would be better to do another PR for it. Let's focus this PR on:
|
@Pierre-Sassoulas I would not recommend this. It just adds too much additional complexity to the tests. Different idea. In essence, this PR will already create separate page for each message. We could add those pages to git and manually add good examples were needed. The sphinx extension would only need to be able to handle custom sections in existing message rst files and don't delete them when updating. That would also allow us to add additional explainations if necessary beyond those in the message dict. |
I don't think this is a good idea. The other extension does this as well (ie, a base file that's overwritten by the extension) and this is really annoying to work with when improving or working on it. The extensions can be run as a script to see if the If we don't want to add these files to the |
I agree with @DanielNoord here, I would favor a fully generated documentation based on files that we need to define now, preferably with no duplication. I don't think it's "additional complexity", it's "stricter structure" and "more automation". Forcing to have a functional test with a good/bad example in a per-determined directory enforced by tests will make some work at first (Some messages do not have functional tests.) then will automate most of the review and guarantee that we'll have an understandable example and a proper documentation. Re-using the functional test will make sure that the example is working and that there is no duplication between doc/tests. Also, I feel like I've spent hours of my life asking for functional tests in reviews π Saw we want to document
Then we create a script / sphinx extension to generate the final In the long run, the only things that would be more complicated than right now is that you have to create the json and make sure that you have two files in the functional tests containing a small understandable example. |
@Pierre-Sassoulas if pylint-errors lib will help pylint then you can do whatever you want with it. I don't mind merging :) |
d3cf867
to
ea46ed2
Compare
Sorry for the commit spam. My local environment doesn't really like running I have added a system to redirect for old names. It can be seen in action for Since all pages need to be referenced in an index, I have also added the renamed messages to the general messages list. As I said, I think this PR should focus on:
These have now all been added so this is ready for review. A follow up issue/PR should then deal with code examples and how we are going to save those. |
Did you try |
Didn't get to it earlier. I wanted to add one more comment about the separate test files. I've stated to understand your intention for it. Although I would suggest to limit the scale. The existing functional tests have a logic on their own which I would prefer not to change. Furthermore, some files check multiple different, but related messages. Breaking that up would just complicate things. Instead, what about create a separate test directory for doc examples? That way we could still validate them while keeping the existing once. Another benefit, the doc examples could be more precise and to the point. Eg. there isn't really a need to have regression tests in the there. At first glance this might sound like duplication, but I'm not sure we even need examples for every message. Most messages are pretty self explanatory. |
This is a lot clearer than what I had in mind. Let's do this. Nice thing about it is that we'll have json and example in the same directory which will help comprehension a lot. I started to enforce one message / one functional test directory and there are a lot of exception (pylint / astroid crash type error for example, we hope there are none), and some messages do not have any tests. Which is a problem that we probably want to fix but it's also time consuming. And as you said some functional tests are multiple message mixed together which is not worth fixing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can make pylint.message
classes better if you need helpers that do not exists yet. It should contains all the information regarding the message we just need to add new API to get it :)
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
for more information, see https://pre-commit.ci
3768ddc
to
8903b95
Compare
Did a force push to make sure the demo documentation generated by this PR is up to date with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this still need review ? I think this is a high priority MR because it does not need to wait for a release to be useful, we could be setting up GitHub pages right now.
I think @cdce8p wanted to a final check to see if he agreed on the proposed links and how we link to renamed messages. That's why I added the @Pierre-Sassoulas Perhaps this is something to name in the summary you always put at the top of a new release. Would be helpful if we got some feedback from people of what they are missing/looking for on these pages. |
Sure we're going to advertise it. Especially if we populated it with pylint-errors content it's definitely going to be a highlight ! But once it's the first result when searching for a message it's going to bring contributions too and the sooner we start "SEO" the better imo. |
@cdce8p Pinging you as I think @Pierre-Sassoulas makes a fair point about SEO and we're nearing the release of |
Blocked by #5730. Afterwards I need to remove the reference to |
We merged #5730, removing the blocked label. |
Code updated! |
The doc job fail becaus eof this warning: |
Fixed! We can't allow |
I'm going to merge, if something need to change we can deal with it in a follow-up. This is nice enough that I'm pretty sure it's useful enough and to not delay too much. I'm quite excited to have an official documentation for each message. Amazing work Daniel ! It's lost in the review comment but the follow-up is #5527. |
Type of Changes
Description
Closes #1056, Closes #2235
Little thing I have worked on. Pages can definitely be improved but I think this is a good start and will help direct users to our documentation via google etc.