ruff/crates
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
..
red_knot Sync vendored typeshed stubs (#11668) 2024-05-31 22:26:20 -06:00
ruff Add RDJson support. (#11682) 2024-06-02 17:59:57 +00:00
ruff_benchmark use owned ast and tokens in bench (#11598) 2024-05-29 18:10:32 +02:00
ruff_cache Move sub-crates to workspace dependencies (#11407) 2024-05-13 14:37:50 +00:00
ruff_dev Move sub-crates to workspace dependencies (#11407) 2024-05-13 14:37:50 +00:00
ruff_diagnostics Move sub-crates to workspace dependencies (#11407) 2024-05-13 14:37:50 +00:00
ruff_formatter Remove some unused `pub` functions (#11576) 2024-05-28 09:56:51 -04:00
ruff_index Move sub-crates to workspace dependencies (#11407) 2024-05-13 14:37:50 +00:00
ruff_linter Add RDJson support. (#11682) 2024-06-02 17:59:57 +00:00
ruff_macros Move sub-crates to workspace dependencies (#11407) 2024-05-13 14:37:50 +00:00
ruff_notebook `ruff server`: Support Jupyter Notebook (`*.ipynb`) files (#11206) 2024-05-21 22:29:30 +00:00
ruff_python_ast [`flake8-pyi`] Implement `PYI064` (#11325) 2024-05-28 23:57:13 +00:00
ruff_python_ast_integration_tests Move sub-crates to workspace dependencies (#11407) 2024-05-13 14:37:50 +00:00
ruff_python_codegen Use find in indent detection (#11650) 2024-05-31 20:35:19 +00:00
ruff_python_formatter Fix incorect placement of trailing stub function comments (#11632) 2024-05-31 12:06:17 +00:00
ruff_python_index Implement a common trait for the string flags (#11564) 2024-05-27 16:02:01 +01:00
ruff_python_literal Remove some unused `pub` functions (#11576) 2024-05-28 09:56:51 -04:00
ruff_python_parser Remove some unused `pub` functions (#11576) 2024-05-28 09:56:51 -04:00
ruff_python_resolver chore(deps): update rust crate insta to v1.38.0 (#10701) 2024-04-01 15:44:30 +00:00
ruff_python_semantic F401 use BTreeMap instead of FxHashMap (#11621) 2024-05-30 10:54:46 -07:00
ruff_python_stdlib Regenerate sys.rs with stdlibs==2024.5.15 (#11437) 2024-05-15 22:17:32 +00:00
ruff_python_trivia Move `has_comments` to `CommentRanges` (#11495) 2024-05-22 13:35:16 +00:00
ruff_python_trivia_integration_tests Add `Tokens` newtype wrapper, `TokenKind` iterator (#11361) 2024-05-14 16:45:04 +00:00
ruff_server Add Vim and Kate setup guide for `ruff server` (#11615) 2024-05-31 19:06:55 +00:00
ruff_source_file Move sub-crates to workspace dependencies (#11407) 2024-05-13 14:37:50 +00:00
ruff_text_size Range formatting: Fix invalid syntax after parenthesizing expression (#9751) 2024-02-02 17:56:25 +01:00
ruff_wasm Add `Tokens` newtype wrapper, `TokenKind` iterator (#11361) 2024-05-14 16:45:04 +00:00
ruff_workspace Respect file exclusions in `ruff server` (#11590) 2024-05-29 02:58:36 +00:00