Conversation
Contributor
|
MichaReiser
reviewed
Jul 11, 2025
| url: Option<String>, | ||
| } | ||
|
|
||
| struct ExpandedEdits<'a> { |
Member
There was a problem hiding this comment.
I'm leaning towards reverting the last commit. The old implementation carefully avoided allocating a new vector for the edits. I also don't think that changing this is necessary for making this more typed. We can just replace the
let value = json!({
"content": edit.content().unwrap_or_default(),
"location": location_to_json(location),
"end_location": location_to_json(end_location)
});and initialize and then serialize said struct instead.
Contributor
Author
There was a problem hiding this comment.
Makes sense, reverted!
This reverts commit 4733e0a.
MichaReiser
approved these changes
Jul 11, 2025
ntBre
added a commit
that referenced
this pull request
Jul 15, 2025
## Summary Another output format like #19133. This is the [reviewdog](https://github.com/reviewdog/reviewdog) output format, which is somewhat similar to regular JSON. Like #19270, in the first commit I converted from using `json!` to `Serialize` structs, then in the second commit I moved the module to `ruff_db`. The reviewdog [schema](https://github.com/reviewdog/reviewdog/blob/320a8e73a94a09248044314d8ca326a6cd710692/proto/rdf/jsonschema/DiagnosticResult.json) seems a bit more flexible than our JSON schema, so I'm not sure if we need any preview checks here. I'll flag the places I wasn't sure about as review comments. ## Test Plan New tests in `rdjson.rs`, ported from the old `rjdson.rs` module, as well as the new CLI output tests. --------- Co-authored-by: Micha Reiser <[email protected]>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
See #19133 (comment) for recent discussion. This PR moves to using structs for the types in our JSON output format instead of the
json!macro.I didn't rename any of the
messagereferences because that should be handled when rebasing #19133 onto this.My plan for handling the
previewbehavior with the new diagnostics is to use a wrapper enum. Something like:Initially I thought I could use a
&dyn Serializefor the affected fields, but I see thatSerializeisn't dyn-compatible in testing this now.Test Plan
Existing tests. One quirk of the new types is that their fields are in alphabetical order. I guess
json!sorts the fields alphabetically? The tests were failing before I sorted the struct fields.Other formats
It looks like the
rdjson,sarif, andgitlabformats also usejson!, so if we decide to merge this, I can do something similar for those before moving them to the new diagnostic format.