ruff/docs
Tobias Fischer 0ea2519e80
Add RDJson support. (#11682)
## Summary

Implement support for RDJson output for `ruff check`, as requested in
#8655.

## Test Plan

Tested using a snapshot test. Same approach as for e.g. the JSON output
formatter.

## Additional info

I tried to keep the implementation close to the JSON implementation.

I had to deviate a bit to make the `suggestions` key work: If there are
no suggestions, then setting `suggestions` to `null` is invalid
according to the JSONSchema. Therefore, I opted for a slightly more
complex implementation, that skips the `suggestions` key entirely if
there are no fixes available for the given diagnostic. Maybe it would
have been easier to set `"suggestions": []`, but I ended up doing it
this way.

I didn't consider notebooks, as I _think_ that RDJson doesn't work with
notebooks. This should be confirmed, and if so, there should be some
form of warning or error emitted when trying to output diagnostics for a
notebook.

I also didn't consider `ruff format`, as this comment:
https://github.com/astral-sh/ruff/issues/8655#issuecomment-1811446160
suggests that that wouldn't be compatible.

I'm new to Rust, any feedback is appreciated. 🙂 I
implemented this in order to have a productive rainy saturday afternoon,
I'm not knowledgeable about RDJson beyond the sources linked in the
issue.
2024-06-02 17:59:57 +00:00
..
.overrides/partials/integrations/analytics Move some MkDocs responsibilities around (#5542) 2023-07-05 22:06:01 +00:00
assets Update docs to match updated logo and color palette (#5283) 2023-06-22 11:19:34 -04:00
formatter Move deviations from formatter README to documentation (#10444) 2024-03-18 08:22:28 +00:00
stylesheets fix(docs): admonition in dark mode (#9502) 2024-01-13 07:43:13 -05:00
.gitignore Fix gitignore to not ignore files that are required (#7538) 2023-09-21 21:33:09 +02:00
configuration.md Add RDJson support. (#11682) 2024-06-02 17:59:57 +00:00
faq.md Support FORCE_COLOR env var (#10839) 2024-04-08 15:29:29 -06:00
formatter.md docs: Lint -> Format in formatter.md (#10777) 2024-04-04 16:50:55 +00:00
installation.md docs: remove . from check and format commands (#10217) 2024-03-13 10:10:48 -05:00
integrations.md Bump version to v0.4.7 (#11646) 2024-05-31 16:30:36 -04:00
linter.md docs: remove . from check and format commands (#10217) 2024-03-13 10:10:48 -05:00
preview.md Spellcheck & grammar (#10375) 2024-03-13 02:34:23 +00:00
requirements-insiders.txt Add a formatting step using mdformat as part of generate_mkdocs.py (#10484) 2024-03-21 00:37:40 +00:00
requirements.txt Add a formatting step using mdformat as part of generate_mkdocs.py (#10484) 2024-03-21 00:37:40 +00:00
tutorial.md Update number of implemented rules to "over 800" (#10500) 2024-03-20 22:39:37 -04:00
versioning.md Spellcheck & grammar (#10375) 2024-03-13 02:34:23 +00:00