[ty] Add hyperlinks to rule codes in CLI by MichaReiser · Pull Request #21502 · astral-sh/ruff (original) (raw)
added ty
Multi-file analysis & type inference
Related to reporting of diagnostics.
labels
MichaReiser changed the title
[ty] Render links for rule codes [ty] Add hyperlinks to rule codes in CLI
ntBre added a commit that referenced this pull request
Summary
This PR wires up the Diagnostic::set_documentation_url method from #21502 to
Ruff's lint diagnostics and renders them in the grouped output format (concise
and full are already covered by #21502).
I considered also including the URLs for the pylint output format, but it doesn't currently render any color in the CLI, so it may be a machine-readable format too?
Test Plan
ntBre mentioned this pull request
ntBre added a commit that referenced this pull request
Summary
This PR wires up the Diagnostic::set_documentation_url method from
#21502 to Ruff's lint diagnostics. This enables the links for the full
and concise output formats without any other changes.
I considered also including the URLs for the grouped and pylint output
formats, but the grouped format is still in ruff_linter instead of
ruff_db, so we'd have to export some additional functionality to wire
it up with fmt_with_hyperlink; and the pylint format doesn't currently
render with color, so I think it might actually be machine readable
rather than human readable?
The other ouput formats (json, json-lines, junit, github, gitlab, rdjson, azure, sarif) seem more clearly not to need the links.
Test Plan
I guess you can't see my cursor or the browser opening, but it works for lint rules, which have links, and doesn't include a link for syntax errors, which don't have valid links.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})