astral-sh / ruff

An extremely fast Python linter and code formatter, written in Rust.
https://docs.astral.sh/ruff
MIT License
31.41k stars 1.05k forks source link

Consider adding a return link to rules? #12496

Open Anselmoo opened 2 months ago

Anselmoo commented 2 months ago

Currently, rules are listed under https://docs.astral.sh/ruff/rules. When a rule is selected, for instance, unpacked-list-comprehension, there is no way to return to the overview.

Details

image

Furthermore, it is recommended to consider adding a discussion button, similar to the edit buttons, on the following URLs:

  1. https://squidfunk.github.io/mkdocs-material/setup/adding-a-git-repository/?h=repo#code-actions
  2. https://squidfunk.github.io/mkdocs-material/reference/buttons/?h=button

Option 2 enables the direct opening of a new discussion thread about the rule. This highlights the importance of discussion in reviewing the implemented rules, as demonstrated in #12345.

charliermarsh commented 2 months ago

I would love a PR for this, I'm not sure how to make it work in MkDocs.

zanieb commented 2 months ago

Would this just involve generating a link to the overview in each rule doc?

I'd rather not include discussion buttons, personally. It feels invasive, the repository is already pinned in the header.

charliermarsh commented 2 months ago

Sorry yes, I was mostly commenting on the backlink.

Anselmoo commented 2 months ago

Would this just involve generating a link to the overview in each rule doc?

I'd rather not include discussion buttons, personally. It feels invasive, the repository is already pinned in the header.

Make sense ... had only the feeling people tend to open faster an Issue then going to the discussion panel.

Anselmoo commented 2 months ago

Sorry yes, I was mostly commenting on the backlink.

So, rules and format are excluded from the navigation bar so as not to mess up the sidebar, but does this actually mean that a customized JS has to be used?

https://github.com/astral-sh/ruff/blob/2a64cccb61f1c84e5a58f907f46111ab36321466/mkdocs.template.yml#L66-L68

Sorry for the question, @charliermarsh and @zanieb, but do you know where the actual docs are in the org, I could not find the markdown files for the rules.

zanieb commented 2 months ago

They're generated with scripts/generate_mkdocs.py which includes crates/ruff_dev/src/generate_docs.rs