Permalink
Browse files

rename CommentWriter to RawCommentWriter

  • Loading branch information...
1 parent 2109a44 commit 4a0d893f4974801ad5c1674b6ccf4a22d53b0562 @haya14busa committed Dec 12, 2016
Showing with 10 additions and 8 deletions.
  1. +2 −2 cmd/reviewdog/main.go
  2. +7 −5 comment_iowriter.go
  3. +1 −1 reviewdog_test.go
@@ -124,15 +124,15 @@ func run(r io.Reader, w io.Writer, opt *option) error {
fmt.Fprintf(os.Stderr, "this is not PullRequest build. CI: %v\n", opt.ci)
return nil
}
- cs = reviewdog.MultiCommentService(gs, reviewdog.NewCommentWriter(w))
+ cs = reviewdog.MultiCommentService(gs, reviewdog.NewRawCommentWriter(w))
ds = gs
} else {
fmt.Fprintf(os.Stderr, "REVIEWDOG_GITHUB_API_TOKEN is not set\n")
return nil
}
} else {
// local
- cs = reviewdog.NewCommentWriter(w)
+ cs = reviewdog.NewRawCommentWriter(w)
d, err := diffService(opt.diffCmd, opt.diffStrip)
if err != nil {
return err
View
@@ -6,17 +6,19 @@ import (
"strings"
)
-var _ CommentService = &CommentWriter{}
+var _ CommentService = &RawCommentWriter{}
-type CommentWriter struct {
+// RawCommentWriter is comment writer which writes results to given writer
+// without any formatting.
+type RawCommentWriter struct {
w io.Writer
}
-func NewCommentWriter(w io.Writer) *CommentWriter {
- return &CommentWriter{w: w}
+func NewRawCommentWriter(w io.Writer) *RawCommentWriter {
+ return &RawCommentWriter{w: w}
}
-func (s *CommentWriter) Post(c *Comment) error {
+func (s *RawCommentWriter) Post(c *Comment) error {
_, err := fmt.Fprintln(s.w, strings.Join(c.CheckResult.Lines, "\n"))
return err
}
View
@@ -48,7 +48,7 @@ golint.new.go:11:1: comment on exported function F2 should be of the form "F2 ..
`
efm, _ := errorformat.NewErrorformat([]string{`%f:%l:%c: %m`})
p := NewErrorformatParser(efm)
- c := NewCommentWriter(os.Stdout)
+ c := NewRawCommentWriter(os.Stdout)
d := NewDiffString(difftext, 1)
app := NewReviewdog("tool name", p, c, d)
app.Run(strings.NewReader(lintresult))

0 comments on commit 4a0d893

Please sign in to comment.