Skip to content

Improve error code linkability #15431

Closed

Description

@Avasam

Documentation

In microsoft/vscode-mypy#58, I'm adding the functionality to link to specific mypy error code documentation. However, there's two issues affecting maintainability:

  • The error codes span 2 pages
  • The anchors are autogenerated from titles

Which leads to having to keep a map of all code-to-url, like this:
https://github.com/microsoft/vscode-mypy/pull/58/files#diff-3c2e579f59d8e749f5527d64f087396907db30414fe139bc91a1ecce9f9613ddR22

I would prefer if it was possible to programmatically link to mypy error codes documentation with only the information given by the mypy/dmypy CLI. Redirection is an acceptable solution to me.

Activity

  1. Avasam commented on Jun 13, 2023

    @Avasam
    SponsorContributorAuthor

    FWIW, if I can get the "Error codes enabled by default" from the mypy CLI, that solves the first point.
    The second one should be solvable with custom RST anchors. https://sublime-and-sphinx-guide.readthedocs.io/en/latest/references.html#use-a-custom-anchor

  2. ikonst commented on Jun 13, 2023

    @ikonst
    Contributor

    Yes, if our error codes pages had custom anchors instead of the autogenerated one, it'd help.

    Random thought - perhaps there's a Sphinx extension, or one could be easily built, to redirect anchors (which should be unique within the docs) to the right page / anchor?

  3. added a commit that references this issue on Jun 14, 2023
  4. ilevkivskyi commented on Jun 14, 2023

    @ilevkivskyi
    Member

    Note btw there is also #7186 I think it is a good idea to add direct short links. I am quite sure we can write a Sphinx extension for this.

  5. ilevkivskyi commented on Jun 14, 2023

    @ilevkivskyi
    Member

    OK, so here is the proposed fix #15435

  6. added a commit that references this issue on Jun 14, 2023
    db97bbc
  7. Avasam commented on Jun 14, 2023

    @Avasam
    SponsorContributorAuthor

    Note btw there is also #7186 I think it is a good idea to add direct short links. I am quite sure we can write a Sphinx extension for this.

    I missed that. This is basically a duplicate. I'm essentially asking for the same thing.

  8. ilevkivskyi commented on Jun 14, 2023

    @ilevkivskyi
    Member

    OK, I guess I actually broke the readthedocs build. Everything works locally and in CI because mypy is available there, but likely not available in readthedocs build env. I will submit a follow-up PR to only verify the error code completeness in tests.

  9. ilevkivskyi commented on Jun 14, 2023

    @ilevkivskyi
    Member

    #15437 should fix the build.

  10. ilevkivskyi commented on Jun 14, 2023

    @ilevkivskyi
    Member
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions