Skip to content

Conversation

haya14busa
Copy link
Member

@haya14busa haya14busa commented Jun 30, 2024

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.

  • Updated Unreleased section in CHANGELOG or it's not notable changes.

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
Copy link
Member

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 {
Copy link
Member

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 {
Copy link
Member

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
Copy link
Member

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 {
Copy link
Member

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 {
Copy link
Member

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 {
Copy link
Member

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

@haya14busa haya14busa marked this pull request as ready for review June 30, 2024 12:35
Co-authored-by: Masaya Suzuki <15100604+massongit@users.noreply.github.com>
Comment on lines +76 to +78
c.Result.Diagnostic.Source = &rdf.Source{
Name: c.ToolName,
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
c.Result.Diagnostic.Source = &rdf.Source{
Name: c.ToolName,
}
c.Result.Diagnostic.Source.Name = c.ToolName

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.

Copy link
Member Author

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.

func (x *Source) GetName() string {
if x != nil {
return x.Name
}
return ""
}

Copy link
Contributor

@shogo82148 shogo82148 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@haya14busa haya14busa merged commit 58e5c48 into master Jun 30, 2024
@haya14busa haya14busa deleted the output-rdjson branch June 30, 2024 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants