-
-
Notifications
You must be signed in to change notification settings - Fork 457
Implement rdjson and rdjsonl reporters #1806
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
It reports output to stdout in rdjson/rdjsonl format. It also changes the default behavior of -filter-mode and -diff command behavior for local (local/rdjson/rdjsonl) reporters. If -filter-mode is not provided (-filter-mode=default) and -diff flag is not provided, reviewdog automatically set -filter-mode=nofilter.
|
||
var _ CommentService = &RDJSONLCommentWriter{} | ||
|
||
// RDJSONLCommentWriter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint-circleci] reported by reviewdog 🐶
comment on exported type RDJSONLCommentWriter should be of the form "RDJSONLCommentWriter ..." (with optional leading article)
w io.Writer | ||
} | ||
|
||
func NewRDJSONLCommentWriter(w io.Writer) *RDJSONLCommentWriter { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint-circleci] reported by reviewdog 🐶
exported function NewRDJSONLCommentWriter should have comment or be unexported
return &RDJSONLCommentWriter{w: w} | ||
} | ||
|
||
func (cw *RDJSONLCommentWriter) Post(_ context.Context, c *Comment) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint-circleci] reported by reviewdog 🐶
exported method RDJSONLCommentWriter.Post should have comment or be unexported
|
||
var _ CommentService = &RDJSONCommentWriter{} | ||
|
||
// RDJSONCommentWriter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint-circleci] reported by reviewdog 🐶
comment on exported type RDJSONCommentWriter should be of the form "RDJSONCommentWriter ..." (with optional leading article)
toolName string | ||
} | ||
|
||
func NewRDJSONCommentWriter(w io.Writer, toolName string) *RDJSONCommentWriter { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint-circleci] reported by reviewdog 🐶
exported function NewRDJSONCommentWriter should have comment or be unexported
return &RDJSONCommentWriter{w: w, toolName: toolName} | ||
} | ||
|
||
func (cw *RDJSONCommentWriter) Post(_ context.Context, c *Comment) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint-circleci] reported by reviewdog 🐶
exported method RDJSONCommentWriter.Post should have comment or be unexported
return nil | ||
} | ||
|
||
func (cw *RDJSONCommentWriter) Flush(_ context.Context) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint-circleci] reported by reviewdog 🐶
exported method RDJSONCommentWriter.Flush should have comment or be unexported
Co-authored-by: Masaya Suzuki <15100604+massongit@users.noreply.github.com>
c.Result.Diagnostic.Source = &rdf.Source{ | ||
Name: c.ToolName, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
c.Result.Diagnostic.Source = &rdf.Source{ | |
Name: c.ToolName, | |
} | |
c.Result.Diagnostic.Source.Name = c.ToolName |
Line 75 in 7b581a6
if c.ToolName != "" && c.Result.Diagnostic.GetSource().GetName() == "" { |
It seems to assume that
c.Result.Diagnostic.Source
is not nil
.Therefore, I think it would be better to assign
Name
instead of assigning Source
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be ok as-is. GetXXX
works even if a receiver is nil and name is expected to be non-empty if Source is non-empty.
reviewdog/proto/rdf/reviewdog.pb.go
Lines 669 to 674 in 7b581a6
func (x *Source) GetName() string { | |
if x != nil { | |
return x.Name | |
} | |
return "" | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
It reports output to stdout in rdjson/rdjsonl format.
It also changes the default behavior of -filter-mode and -diff command
behavior for local (local/rdjson/rdjsonl) reporters.
If -filter-mode is not provided (-filter-mode=default) and -diff flag is
not provided, reviewdog automatically set -filter-mode=nofilter.