Skip to content

Commit

Permalink
Merge pull request #1858 from reviewdog/remove-original-output
Browse files Browse the repository at this point in the history
Remove original_output from RDJSON(L) output
  • Loading branch information
haya14busa authored Jul 28, 2024
2 parents e19099c + 8839073 commit 7666ae6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- ...

### :rotating_light: Breaking changes
- [#1858](https://github.com/reviewdog/reviewdog/pull/1858) Remove original_output from rdjson/rdjsonl reporters' output
- ...

## [v0.20.1] - 2024-07-10
Expand Down
4 changes: 4 additions & 0 deletions comment_iowriter.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ func (cw *RDJSONLCommentWriter) Post(_ context.Context, c *Comment) error {
Name: c.ToolName,
}
}
// Remove OriginalOutput. It's used internally and we shouldn't expose it as output.
c.Result.Diagnostic.OriginalOutput = ""
b, err := protojson.MarshalOptions{
UseProtoNames: true,
UseEnumNumbers: false,
Expand Down Expand Up @@ -124,6 +126,8 @@ func (cw *RDJSONCommentWriter) Flush(_ context.Context) error {
Diagnostics: make([]*rdf.Diagnostic, 0, len(cw.comments)),
}
for _, c := range cw.comments {
// Remove OriginalOutput. It's used internally and we shouldn't expose it as output.
c.Result.Diagnostic.OriginalOutput = ""
result.Diagnostics = append(result.Diagnostics, c.Result.Diagnostic)
}
b, err := protojson.MarshalOptions{
Expand Down
10 changes: 6 additions & 4 deletions comment_iowriter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,9 @@ func TestRDJSONLCommentWriter_Post(t *testing.T) {
in: &Comment{
Result: &filter.FilteredDiagnostic{
Diagnostic: &rdf.Diagnostic{
Location: &rdf.Location{Path: "/path/to/file"},
Message: "message",
Location: &rdf.Location{Path: "/path/to/file"},
Message: "message",
OriginalOutput: "original output",
},
},
ToolName: "tool name",
Expand Down Expand Up @@ -167,8 +168,9 @@ func TestRDJSONCommentWriter_Post(t *testing.T) {
{
Result: &filter.FilteredDiagnostic{
Diagnostic: &rdf.Diagnostic{
Location: &rdf.Location{Path: "/path/to/file"},
Message: "message",
Location: &rdf.Location{Path: "/path/to/file"},
Message: "message",
OriginalOutput: "original output",
},
},
ToolName: "tool name",
Expand Down

0 comments on commit 7666ae6

Please sign in to comment.