-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
docs: feature-request: add aliases for short codes and add new format mode #4710
Comments
You actually can link to these on the main page via anchors, like https://beta.ruff.rs/docs/rules#F401, but it's not ideal. However, we do want to move towards using the human-readable names everywhere eventually, so I'm not likely to prioritize this personally. |
Long names are great too, but they will take up a lot of space in the links (if implemented) within the error. I saw this idea in the linter ShellCheck for Visual Studio Code, when hovering over the error in the IDE - a link is displayed (in the example it is SC2086 on the right) and when you click on it we get to the page: https://www.shellcheck.net/wiki/SC2086 This is very handy: if you don't know what is the right fix, go to the documentation for the rule and see examples. PS: or make a subdomain with short links that will redirect to long links. For example: |
It would be nice to include those links in the LSP. |
One thing we could do: add a Cloudflare Worker to redirect |
That would be wonderful! After that, someone can embed links in the error log to go directly from the console to the rule description |
## Summary This adds redirects from, e.g., `https://docs.astral.sh/ruff/rules/F401` to `https://docs.astral.sh/ruff/rules/unused-import`, which are generated automatically when creating the documentation. Though we want to move towards human-readable names eventually, I think this is a nice and user-friendly change (and doesn't require any fancy infrastructure, since the redirects are handled via a plugin and added client-side). Closes #4710.
It would be great if for every rule that has a page in the documentation you could go to it not only by its full name (
unused-import
: https://beta.ruff.rs/docs/rules/unused-import/ ) but also by its short code (F401
: https://beta.ruff.rs/docs/rules/F401/).This would make it easier to find best practice examples for this bug.
Also, I suggest adding a separate formatting mode based on
text
(e.g., call ittext_links
). In which a link to such pages would be given next to the short error code. For example, it could look like this:Or, for example, add a separate setting to enable link display mode, which will add links for formatting modes:
text
,grouped
This would make it a lot easier to find "how to do it better" examples and links to the original rules from the linters (which are on the rules pages) and would speed up the process of correcting mistakes.
PS: In option
format
there is nogroupped
in the default values.The text was updated successfully, but these errors were encountered: