From 8a87f6801026c72f3a8bead1da6d4679c4ee531a Mon Sep 17 00:00:00 2001 From: haya14busa Date: Sat, 27 Jul 2024 12:44:42 +0900 Subject: [PATCH 1/3] Remove original_output from RDJSON(L) output It's used internally and we shouldn't expose it as output. --- comment_iowriter.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/comment_iowriter.go b/comment_iowriter.go index e69330cf..77c1ea57 100644 --- a/comment_iowriter.go +++ b/comment_iowriter.go @@ -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, @@ -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{ From 4d461b4279d1e2a92a8312b763b29f4d157a8bc3 Mon Sep 17 00:00:00 2001 From: haya14busa Date: Sat, 27 Jul 2024 12:46:15 +0900 Subject: [PATCH 2/3] Update CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f51a47b..1a6c22ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 From 8839073956ee6610e2a75b6efa2082cb59e144cd Mon Sep 17 00:00:00 2001 From: haya14busa Date: Sat, 27 Jul 2024 12:47:36 +0900 Subject: [PATCH 3/3] Update test --- comment_iowriter_test.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/comment_iowriter_test.go b/comment_iowriter_test.go index 8aeaf502..ac75f43b 100644 --- a/comment_iowriter_test.go +++ b/comment_iowriter_test.go @@ -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", @@ -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",