Repository: reviewdog/reviewdog
Pull request #693 (2020-07-25 12:09:38)

doghouse: sleep 1 sec before retrying
- [x] Updated Unreleased section in [CHANGELOG](https://github.com/reviewdog/reviewdog/blob/master/CHANGELOG.md) or it's not notable changes.




Patch:
diff --git a/cmd/reviewdog/doghouse.go b/cmd/reviewdog/doghouse.go
index 19ee9f27..6fbda8bb 100644
--- a/cmd/reviewdog/doghouse.go
+++ b/cmd/reviewdog/doghouse.go
@@ -8,6 +8,7 @@ import (
 	"log"
 	"net/http"
 	"os"
+	"path/filepath"
 	"sort"
 
 	"golang.org/x/oauth2"
@@ -17,7 +18,6 @@ import (
 	"github.com/reviewdog/reviewdog/cienv"
 	"github.com/reviewdog/reviewdog/doghouse"
 	"github.com/reviewdog/reviewdog/doghouse/client"
-	"github.com/reviewdog/reviewdog/filter"
 	"github.com/reviewdog/reviewdog/project"
 	"github.com/reviewdog/reviewdog/proto/rdf"
 	"github.com/reviewdog/reviewdog/service/github/githubutils"
@@ -156,7 +156,7 @@ func postResultSet(ctx context.Context, resultSet *reviewdog.ResultMap,
 				// it failed to report results with Check API.
 				filteredResultSet.Store(name, &reviewdog.FilteredResult{
 					Level:         result.Level,
-					FilteredDiagnostic: res.CheckedResults,
+					FilteredCheck: res.CheckedResults,
 				})
 			}
 			if res.ReportURL == "" && res.CheckedResults == nil {
@@ -179,7 +179,8 @@ func postResultSet(ctx context.Context, resultSet *reviewdog.ResultMap,
 }
 
 func checkResultToAnnotation(d *rdf.Diagnostic, wd, gitRelWd string) *doghouse.Annotation {
-	d.GetLocation().Path = filter.NormalizePath(d.GetLocation().GetPath(), wd, gitRelWd)
+	d.GetLocation().Path = filepath.ToSlash(filepath.Join(
+		gitRelWd, reviewdog.CleanPath(d.GetLocation().GetPath(), wd)))
 	return &doghouse.Annotation{
 		Diagnostic: d,
 	}
@@ -217,7 +218,7 @@ report results via logging command [1].
 		fmt.Fprintf(w, "reviewdog: Reporting results for %q\n", name)
 		foundResultPerName := false
 		filteredNum := 0
-		for _, result := range results.FilteredDiagnostic {
+		for _, result := range results.FilteredCheck {
 			if !result.ShouldReport {
 				filteredNum++
 				continue
diff --git a/cmd/reviewdog/main.go b/cmd/reviewdog/main.go
index 47e03100..0d6d0c98 100644
--- a/cmd/reviewdog/main.go
+++ b/cmd/reviewdog/main.go
@@ -27,7 +27,7 @@ import (
 	"github.com/reviewdog/reviewdog"
 	"github.com/reviewdog/reviewdog/cienv"
 	"github.com/reviewdog/reviewdog/commands"
-	"github.com/reviewdog/reviewdog/filter"
+	"github.com/reviewdog/reviewdog/difffilter"
 	"github.com/reviewdog/reviewdog/parser"
 	"github.com/reviewdog/reviewdog/project"
 	gerritservice "github.com/reviewdog/reviewdog/service/gerrit"
@@ -57,7 +57,7 @@ type option struct {
 	level            string
 	guessPullRequest bool
 	tee              bool
-	filterMode       filter.Mode
+	filterMode       difffilter.Mode
 	failOnError      bool
 }
 
@@ -335,7 +335,7 @@ github-pr-check reporter as a fallback.
 		}
 		ds = d
 	case "local":
-		if opt.diffCmd == "" && opt.filterMode == filter.ModeNoFilter {
+		if opt.diffCmd == "" && opt.filterMode == difffilter.ModeNoFilter {
 			ds = &reviewdog.EmptyDiff{}
 		} else {
 			d, err := diffService(opt.diffCmd, opt.diffStrip)
diff --git a/filter/diff_filter.go b/difffilter/filter.go
similarity index 89%
rename from filter/diff_filter.go
rename to difffilter/filter.go
index 43af4fbe..e33cc4bf 100644
--- a/filter/diff_filter.go
+++ b/difffilter/filter.go
@@ -1,4 +1,4 @@
-package filter
+package difffilter
 
 import (
 	"fmt"
@@ -86,8 +86,8 @@ type difflines map[normalizedPath]map[int]*diff.Line
 // difffiles is a hash table of normalizedPath to *diff.FileDiff.
 type difffiles map[normalizedPath]*diff.FileDiff
 
-// NewDiffFilter creates a new DiffFilter.
-func NewDiffFilter(diff []*diff.FileDiff, strip int, cwd string, mode Mode) *DiffFilter {
+// New creates a new DiffFilter.
+func New(diff []*diff.FileDiff, strip int, cwd string, mode Mode) *DiffFilter {
 	df := &DiffFilter{
 		strip:     strip,
 		cwd:       cwd,
@@ -153,7 +153,19 @@ func (df *DiffFilter) isSignificantLine(line *diff.Line) bool {
 type normalizedPath struct{ p string }
 
 func (df *DiffFilter) normalizePath(path string) normalizedPath {
-	return normalizedPath{p: NormalizePath(path, df.cwd, df.projectRelPath)}
+	path = filepath.Clean(path)
+	// Convert absolute path to relative path only if the path is in current
+	// directory.
+	if filepath.IsAbs(path) && df.cwd != "" && contains(path, df.cwd) {
+		relPath, err := filepath.Rel(df.cwd, path)
+		if err == nil {
+			path = relPath
+		}
+	}
+	if !filepath.IsAbs(path) && df.projectRelPath != "" {
+		path = filepath.Join(df.projectRelPath, path)
+	}
+	return normalizedPath{p: filepath.ToSlash(path)}
 }
 
 func contains(path, base string) bool {
diff --git a/doghouse/server/doghouse.go b/doghouse/server/doghouse.go
index 0dc33744..acd210b9 100644
--- a/doghouse/server/doghouse.go
+++ b/doghouse/server/doghouse.go
@@ -10,9 +10,10 @@ import (
 
 	"github.com/google/go-github/v32/github"
 
+	"github.com/reviewdog/reviewdog"
 	"github.com/reviewdog/reviewdog/diff"
+	"github.com/reviewdog/reviewdog/difffilter"
 	"github.com/reviewdog/reviewdog/doghouse"
-	"github.com/reviewdog/reviewdog/filter"
 	"github.com/reviewdog/reviewdog/proto/rdf"
 	"github.com/reviewdog/reviewdog/service/github/githubutils"
 )
@@ -55,9 +56,9 @@ func (ch *Checker) Check(ctx context.Context) (*doghouse.CheckResponse, error) {
 	if ch.req.PullRequest == 0 || ch.req.OutsideDiff {
 		// If it's not Pull Request run, do not filter results by diff regardless
 		// of the filter mode.
-		filterMode = filter.ModeNoFilter
+		filterMode = difffilter.ModeNoFilter
 	}
-	filtered := filter.FilterCheck(results, filediffs, 1, "", filterMode)
+	filtered := reviewdog.FilterCheck(results, filediffs, 1, "", filterMode)
 	check, err := ch.createCheck(ctx)
 	if err != nil {
 		// If this error is StatusForbidden (403) here, it means reviewdog is
@@ -83,7 +84,7 @@ func (ch *Checker) Check(ctx context.Context) (*doghouse.CheckResponse, error) {
 	return res, nil
 }
 
-func (ch *Checker) postCheck(ctx context.Context, checkID int64, checks []*filter.FilteredDiagnostic) (*github.CheckRun, string, error) {
+func (ch *Checker) postCheck(ctx context.Context, checkID int64, checks []*reviewdog.FilteredCheck) (*github.CheckRun, string, error) {
 	var annotations []*github.CheckRunAnnotation
 	for _, c := range checks {
 		if !c.ShouldReport {
@@ -194,12 +195,12 @@ func (ch *Checker) reqAnnotationLevel() string {
 	return "failure"
 }
 
-func (ch *Checker) summary(checks []*filter.FilteredDiagnostic) string {
+func (ch *Checker) summary(checks []*reviewdog.FilteredCheck) string {
 	var lines []string
 	lines = append(lines, "reported by [reviewdog](https://github.com/reviewdog/reviewdog) :dog:")
 
-	var findings []*filter.FilteredDiagnostic
-	var filteredFindings []*filter.FilteredDiagnostic
+	var findings []*reviewdog.FilteredCheck
+	var filteredFindings []*reviewdog.FilteredCheck
 	for _, c := range checks {
 		if c.ShouldReport {
 			findings = append(findings, c)
@@ -213,7 +214,7 @@ func (ch *Checker) summary(checks []*filter.FilteredDiagnostic) string {
 	return strings.Join(lines, "\n")
 }
 
-func (ch *Checker) summaryFindings(name string, checks []*filter.FilteredDiagnostic) []string {
+func (ch *Checker) summaryFindings(name string, checks []*reviewdog.FilteredCheck) []string {
 	var lines []string
 	lines = append(lines, "<details>")
 	lines = append(lines, fmt.Sprintf("<summary>%s (%d)</summary>", name, len(checks)))
@@ -230,7 +231,7 @@ func (ch *Checker) summaryFindings(name string, checks []*filter.FilteredDiagnos
 	return lines
 }
 
-func (ch *Checker) toCheckRunAnnotation(c *filter.FilteredDiagnostic) *github.CheckRunAnnotation {
+func (ch *Checker) toCheckRunAnnotation(c *reviewdog.FilteredCheck) *github.CheckRunAnnotation {
 	loc := c.Diagnostic.GetLocation()
 	startLine := int(loc.GetRange().GetStart().GetLine())
 	endLine := int(loc.GetRange().GetEnd().GetLine())
diff --git a/doghouse/server/github_checker.go b/doghouse/server/github_checker.go
index adb9a33d..ce8df563 100644
--- a/doghouse/server/github_checker.go
+++ b/doghouse/server/github_checker.go
@@ -3,6 +3,7 @@ package server
 import (
 	"context"
 	"io/ioutil"
+	"time"
 
 	"github.com/google/go-github/v32/github"
 	"github.com/vvakame/sdlog/aelog"
@@ -30,8 +31,8 @@ func (c *checkerGitHubClient) CreateCheckRun(ctx context.Context, owner, repo st
 }
 
 func (c *checkerGitHubClient) UpdateCheckRun(ctx context.Context, owner, repo string, checkID int64, opt github.UpdateCheckRunOptions) (*github.CheckRun, error) {
-	// Retry upto 5 times.
-	// GitHub API somehow returns 401 Bad credentials from time to time...
+	// Retry requests because GitHub API somehow returns 401 Bad credentials from
+	// time to time...
 	var err error
 	for i := 0; i < 5; i++ {
 		checkRun, resp, err1 := c.Checks.UpdateCheckRun(ctx, owner, repo, checkID, opt)
@@ -42,7 +43,8 @@ func (c *checkerGitHubClient) UpdateCheckRun(ctx context.Context, owner, repo st
 				aelog.Errorf(ctx, "failed to read error response body: %v", err1)
 			}
 			aelog.Errorf(ctx, "UpdateCheckRun failed: %s", string(b))
-			aelog.Errorf(ctx, "Retry UpdateCheckRun: %d", i+1)
+			aelog.Debugf(ctx, "Retrying UpdateCheckRun...: %d", i+1)
+			time.Sleep(time.Second)
 			continue
 		}
 		return checkRun, nil
diff --git a/doghouse/service.go b/doghouse/service.go
index fd61029b..97e18ba4 100644
--- a/doghouse/service.go
+++ b/doghouse/service.go
@@ -1,7 +1,8 @@
 package doghouse
 
 import (
-	"github.com/reviewdog/reviewdog/filter"
+	"github.com/reviewdog/reviewdog"
+	"github.com/reviewdog/reviewdog/difffilter"
 	"github.com/reviewdog/reviewdog/proto/rdf"
 )
 
@@ -37,7 +38,7 @@ type CheckRequest struct {
 	// Optional.
 	Level string `json:"level"`
 
-	// Deprecated: Use FilterMode == filter.NoFilter instead.
+	// Deprecated: Use FilterMode == difffilter.NoFilter instead.
 	//
 	// OutsideDiff represents whether it report results in outside diff or not as
 	// annotations. It's useful only when PullRequest != 0. If PullRequest is
@@ -48,7 +49,7 @@ type CheckRequest struct {
 
 	// FilterMode represents a way to filter checks results
 	// Optional.
-	FilterMode filter.Mode `json:"filter_mode"`
+	FilterMode difffilter.Mode `json:"filter_mode"`
 }
 
 // CheckResponse represents doghouse GitHub check response.
@@ -65,7 +66,7 @@ type CheckResponse struct {
 	// TODO(haya14busa): Consider to move this type to this package to avoid
 	// (cyclic) import.
 	// Optional.
-	CheckedResults []*filter.FilteredDiagnostic `json:"checked_results"`
+	CheckedResults []*reviewdog.FilteredCheck `json:"checked_results"`
 
 	// Conclusion of check result, which is same as GitHub's conclusion of Check
 	// API. https://developer.github.com/v3/checks/runs/#parameters-1
diff --git a/filter/filter.go b/filter.go
similarity index 63%
rename from filter/filter.go
rename to filter.go
index 848faa31..aa4b3d45 100644
--- a/filter/filter.go
+++ b/filter.go
@@ -1,14 +1,15 @@
-package filter
+package reviewdog
 
 import (
 	"path/filepath"
 
 	"github.com/reviewdog/reviewdog/diff"
+	"github.com/reviewdog/reviewdog/difffilter"
 	"github.com/reviewdog/reviewdog/proto/rdf"
 )
 
-// FilteredDiagnostic represents Diagnostic with filtering info.
-type FilteredDiagnostic struct {
+// FilteredCheck represents Diagnostic with filtering info.
+type FilteredCheck struct {
 	Diagnostic   *rdf.Diagnostic
 	ShouldReport bool
 	// false if the result is outside diff files.
@@ -22,15 +23,14 @@ type FilteredDiagnostic struct {
 }
 
 // FilterCheck filters check results by diff. It doesn't drop check which
-// is not in diff but set FilteredDiagnostic.ShouldReport field false.
+// is not in diff but set FilteredCheck.ShouldReport field false.
 func FilterCheck(results []*rdf.Diagnostic, diff []*diff.FileDiff, strip int,
-	cwd string, mode Mode) []*FilteredDiagnostic {
-	checks := make([]*FilteredDiagnostic, 0, len(results))
-	df := NewDiffFilter(diff, strip, cwd, mode)
+	cwd string, mode difffilter.Mode) []*FilteredCheck {
+	checks := make([]*FilteredCheck, 0, len(results))
+	df := difffilter.New(diff, strip, cwd, mode)
 	for _, result := range results {
-		check := &FilteredDiagnostic{Diagnostic: result}
+		check := &FilteredCheck{Diagnostic: result}
 		loc := result.GetLocation()
-		loc.Path = NormalizePath(loc.GetPath(), cwd, "")
 		startLine := int(loc.GetRange().GetStart().GetLine())
 		endLine := int(loc.GetRange().GetEnd().GetLine())
 		if endLine == 0 {
@@ -50,41 +50,40 @@ func FilterCheck(results []*rdf.Diagnostic, diff []*diff.FileDiff, strip int,
 				}
 			}
 		}
-		// loc.Path = NormalizePath(loc.GetPath(), cwd, "")
+		loc.Path = CleanPath(loc.GetPath(), cwd)
 		checks = append(checks, check)
 	}
 	return checks
 }
 
-// NormalizePath return normalized path with workdir and relative path to
-// project.
-func NormalizePath(path, workdir, projectRelPath string) string {
-	path = filepath.Clean(path)
-	if path == "." {
-		return ""
-	}
-	// Convert absolute path to relative path only if the path is in current
-	// directory.
-	if filepath.IsAbs(path) && workdir != "" && contains(path, workdir) {
+// CleanPath clean up given path. If workdir is not empty, it returns relative
+// path to the given workdir.
+//
+// TODO(haya14busa): DRY. Create shared logic between this and
+// difffilter.normalizePath.
+func CleanPath(path, workdir string) string {
+	p := path
+	if filepath.IsAbs(path) && workdir != "" {
 		relPath, err := filepath.Rel(workdir, path)
 		if err == nil {
-			path = relPath
+			p = relPath
 		}
 	}
-	if !filepath.IsAbs(path) && projectRelPath != "" {
-		path = filepath.Join(projectRelPath, path)
+	p = filepath.Clean(p)
+	if p == "." {
+		return ""
 	}
-	return filepath.ToSlash(path)
+	return filepath.ToSlash(p)
 }
 
 func getOldPosition(filediff *diff.FileDiff, strip int, newPath string, newLine int) (oldPath string, oldLine int) {
 	if filediff == nil {
 		return "", 0
 	}
-	if NormalizeDiffPath(filediff.PathNew, strip) != newPath {
+	if difffilter.NormalizeDiffPath(filediff.PathNew, strip) != newPath {
 		return "", 0
 	}
-	oldPath = NormalizeDiffPath(filediff.PathOld, strip)
+	oldPath = difffilter.NormalizeDiffPath(filediff.PathOld, strip)
 	delta := 0
 	for _, hunk := range filediff.Hunks {
 		if newLine < hunk.StartLineNew {
diff --git a/project/run.go b/project/run.go
index d52f03cf..90a6128d 100644
--- a/project/run.go
+++ b/project/run.go
@@ -14,7 +14,7 @@ import (
 
 	"github.com/reviewdog/reviewdog"
 	"github.com/reviewdog/reviewdog/diff"
-	"github.com/reviewdog/reviewdog/filter"
+	"github.com/reviewdog/reviewdog/difffilter"
 	"github.com/reviewdog/reviewdog/parser"
 )
 
@@ -91,7 +91,7 @@ func RunAndParse(ctx context.Context, conf *Config, runners map[string]bool, def
 }
 
 // Run runs reviewdog tasks based on Config.
-func Run(ctx context.Context, conf *Config, runners map[string]bool, c reviewdog.CommentService, d reviewdog.DiffService, teeMode bool, filterMode filter.Mode, failOnError bool) error {
+func Run(ctx context.Context, conf *Config, runners map[string]bool, c reviewdog.CommentService, d reviewdog.DiffService, teeMode bool, filterMode difffilter.Mode, failOnError bool) error {
 	results, err := RunAndParse(ctx, conf, runners, "", teeMode) // Level is not used.
 	if err != nil {
 		return err
diff --git a/proto/rdf/reviewdog.pb.go b/proto/rdf/reviewdog.pb.go
index b8fbcf25..3a59ed11 100644
--- a/proto/rdf/reviewdog.pb.go
+++ b/proto/rdf/reviewdog.pb.go
@@ -21,12 +21,11 @@
 package rdf
 
 import (
-	reflect "reflect"
-	sync "sync"
-
 	proto "github.com/golang/protobuf/proto"
 	protoreflect "google.golang.org/protobuf/reflect/protoreflect"
 	protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+	reflect "reflect"
+	sync "sync"
 )
 
 const (
diff --git a/resultmap.go b/resultmap.go
index 785dca72..588b2e32 100644
--- a/resultmap.go
+++ b/resultmap.go
@@ -5,7 +5,6 @@ import (
 	"fmt"
 	"sync"
 
-	"github.com/reviewdog/reviewdog/filter"
 	"github.com/reviewdog/reviewdog/proto/rdf"
 )
 
@@ -76,7 +75,7 @@ func (rm *ResultMap) Len() int {
 
 type FilteredResult struct {
 	Level         string
-	FilteredDiagnostic []*filter.FilteredDiagnostic
+	FilteredCheck []*FilteredCheck
 }
 
 // FilteredResultMap represents a concurrent-safe map to store Diagnostics generated by concurrent jobs.
diff --git a/reviewdog.go b/reviewdog.go
index 39170aa2..96a232e1 100644
--- a/reviewdog.go
+++ b/reviewdog.go
@@ -8,7 +8,7 @@ import (
 	"os"
 
 	"github.com/reviewdog/reviewdog/diff"
-	"github.com/reviewdog/reviewdog/filter"
+	"github.com/reviewdog/reviewdog/difffilter"
 	"github.com/reviewdog/reviewdog/parser"
 	"github.com/reviewdog/reviewdog/proto/rdf"
 )
@@ -21,24 +21,24 @@ type Reviewdog struct {
 	p           parser.Parser
 	c           CommentService
 	d           DiffService
-	filterMode  filter.Mode
+	filterMode  difffilter.Mode
 	failOnError bool
 }
 
 // NewReviewdog returns a new Reviewdog.
-func NewReviewdog(toolname string, p parser.Parser, c CommentService, d DiffService, filterMode filter.Mode, failOnError bool) *Reviewdog {
+func NewReviewdog(toolname string, p parser.Parser, c CommentService, d DiffService, filterMode difffilter.Mode, failOnError bool) *Reviewdog {
 	return &Reviewdog{p: p, c: c, d: d, toolname: toolname, filterMode: filterMode, failOnError: failOnError}
 }
 
 // RunFromResult creates a new Reviewdog and runs it with check results.
 func RunFromResult(ctx context.Context, c CommentService, results []*rdf.Diagnostic,
-	filediffs []*diff.FileDiff, strip int, toolname string, filterMode filter.Mode, failOnError bool) error {
+	filediffs []*diff.FileDiff, strip int, toolname string, filterMode difffilter.Mode, failOnError bool) error {
 	return (&Reviewdog{c: c, toolname: toolname, filterMode: filterMode, failOnError: failOnError}).runFromResult(ctx, results, filediffs, strip, failOnError)
 }
 
 // Comment represents a reported result as a comment.
 type Comment struct {
-	Result   *filter.FilteredDiagnostic
+	Result   *FilteredCheck
 	ToolName string
 	Body     string
 }
@@ -68,7 +68,7 @@ func (w *Reviewdog) runFromResult(ctx context.Context, results []*rdf.Diagnostic
 		return err
 	}
 
-	checks := filter.FilterCheck(results, filediffs, strip, wd, w.filterMode)
+	checks := FilterCheck(results, filediffs, strip, wd, w.filterMode)
 	hasViolations := false
 
 	for _, check := range checks {
@@ -118,3 +118,4 @@ func (w *Reviewdog) Run(ctx context.Context, r io.Reader) error {
 
 	return w.runFromResult(ctx, results, filediffs, w.d.Strip(), w.failOnError)
 }
+


Test patch:
diff --git a/cmd/reviewdog/doghouse_test.go b/cmd/reviewdog/doghouse_test.go
index 8aa6fac0..91bde139 100644
--- a/cmd/reviewdog/doghouse_test.go
+++ b/cmd/reviewdog/doghouse_test.go
@@ -16,9 +16,9 @@ import (
 
 	"github.com/reviewdog/reviewdog"
 	"github.com/reviewdog/reviewdog/cienv"
+	"github.com/reviewdog/reviewdog/difffilter"
 	"github.com/reviewdog/reviewdog/doghouse"
 	"github.com/reviewdog/reviewdog/doghouse/client"
-	"github.com/reviewdog/reviewdog/filter"
 	"github.com/reviewdog/reviewdog/project"
 	"github.com/reviewdog/reviewdog/proto/rdf"
 )
@@ -313,7 +313,7 @@ func TestPostResultSet_withReportURL(t *testing.T) {
 		SHA:         sha,
 	}
 
-	opt := &option{filterMode: filter.ModeAdded}
+	opt := &option{filterMode: difffilter.ModeAdded}
 	if _, err := postResultSet(context.Background(), &resultSet, ghInfo, fakeCli, opt); err != nil {
 		t.Fatal(err)
 	}
@@ -327,7 +327,7 @@ func TestPostResultSet_withoutReportURL(t *testing.T) {
 		sha   = "1414"
 	)
 
-	wantResults := []*filter.FilteredDiagnostic{{ShouldReport: true}}
+	wantResults := []*reviewdog.FilteredCheck{{ShouldReport: true}}
 	fakeCli := &fakeDoghouseServerCli{}
 	fakeCli.FakeCheck = func(ctx context.Context, req *doghouse.CheckRequest) (*doghouse.CheckResponse, error) {
 		return &doghouse.CheckResponse{CheckedResults: wantResults}, nil
@@ -338,7 +338,7 @@ func TestPostResultSet_withoutReportURL(t *testing.T) {
 
 	ghInfo := &cienv.BuildInfo{Owner: owner, Repo: repo, PullRequest: prNum, SHA: sha}
 
-	opt := &option{filterMode: filter.ModeAdded}
+	opt := &option{filterMode: difffilter.ModeAdded}
 	resp, err := postResultSet(context.Background(), &resultSet, ghInfo, fakeCli, opt)
 	if err != nil {
 		t.Fatal(err)
@@ -350,7 +350,7 @@ func TestPostResultSet_withoutReportURL(t *testing.T) {
 	if err != nil {
 		t.Fatalf("should have result for name1: %v", err)
 	}
-	if diff := cmp.Diff(results.FilteredDiagnostic, wantResults, protocmp.Transform()); diff != "" {
+	if diff := cmp.Diff(results.FilteredCheck, wantResults, protocmp.Transform()); diff != "" {
 		t.Errorf("results has diff:\n%s", diff)
 	}
 }
@@ -385,7 +385,7 @@ func TestPostResultSet_conclusion(t *testing.T) {
 		fakeCli.FakeCheck = func(ctx context.Context, req *doghouse.CheckRequest) (*doghouse.CheckResponse, error) {
 			return &doghouse.CheckResponse{ReportURL: "xxx", Conclusion: tt.conclusion}, nil
 		}
-		opt := &option{filterMode: filter.ModeAdded, failOnError: tt.failOnError}
+		opt := &option{filterMode: difffilter.ModeAdded, failOnError: tt.failOnError}
 		id := fmt.Sprintf("[conclusion=%s, failOnError=%v]", tt.conclusion, tt.failOnError)
 		_, err := postResultSet(context.Background(), &resultSet, ghInfo, fakeCli, opt)
 		if tt.wantErr && err == nil {
@@ -414,7 +414,7 @@ func TestPostResultSet_withEmptyResponse(t *testing.T) {
 
 	ghInfo := &cienv.BuildInfo{Owner: owner, Repo: repo, PullRequest: prNum, SHA: sha}
 
-	opt := &option{filterMode: filter.ModeAdded}
+	opt := &option{filterMode: difffilter.ModeAdded}
 	if _, err := postResultSet(context.Background(), &resultSet, ghInfo, fakeCli, opt); err == nil {
 		t.Error("got no error but want report missing error")
 	}
@@ -428,7 +428,7 @@ func TestReportResults(t *testing.T) {
 	defer cleanup()
 	filteredResultSet := new(reviewdog.FilteredResultMap)
 	filteredResultSet.Store("name1", &reviewdog.FilteredResult{
-		FilteredDiagnostic: []*filter.FilteredDiagnostic{
+		FilteredCheck: []*reviewdog.FilteredCheck{
 			{
 				Diagnostic: &rdf.Diagnostic{
 					OriginalOutput: "name1-L1\nname1-L2",
@@ -444,7 +444,7 @@ func TestReportResults(t *testing.T) {
 		},
 	})
 	filteredResultSet.Store("name2", &reviewdog.FilteredResult{
-		FilteredDiagnostic: []*filter.FilteredDiagnostic{
+		FilteredCheck: []*reviewdog.FilteredCheck{
 			{
 				Diagnostic: &rdf.Diagnostic{
 					OriginalOutput: "name1-L1\nname1-L2",
@@ -477,7 +477,7 @@ func TestReportResults_inGitHubAction(t *testing.T) {
 	defer cleanup()
 	filteredResultSet := new(reviewdog.FilteredResultMap)
 	filteredResultSet.Store("name1", &reviewdog.FilteredResult{
-		FilteredDiagnostic: []*filter.FilteredDiagnostic{
+		FilteredCheck: []*reviewdog.FilteredCheck{
 			{
 				Diagnostic: &rdf.Diagnostic{
 					OriginalOutput: "name1-L1\nname1-L2",
@@ -503,7 +503,7 @@ func TestReportResults_noResultsShouldReport(t *testing.T) {
 	defer cleanup()
 	filteredResultSet := new(reviewdog.FilteredResultMap)
 	filteredResultSet.Store("name1", &reviewdog.FilteredResult{
-		FilteredDiagnostic: []*filter.FilteredDiagnostic{
+		FilteredCheck: []*reviewdog.FilteredCheck{
 			{
 				Diagnostic: &rdf.Diagnostic{
 					OriginalOutput: "name1-L1\nname1-L2",
@@ -519,7 +519,7 @@ func TestReportResults_noResultsShouldReport(t *testing.T) {
 		},
 	})
 	filteredResultSet.Store("name2", &reviewdog.FilteredResult{
-		FilteredDiagnostic: []*filter.FilteredDiagnostic{
+		FilteredCheck: []*reviewdog.FilteredCheck{
 			{
 				Diagnostic: &rdf.Diagnostic{
 					OriginalOutput: "name1-L1\nname1-L2",
diff --git a/cmd/reviewdog/main_test.go b/cmd/reviewdog/main_test.go
index 330d574d..70326194 100644
--- a/cmd/reviewdog/main_test.go
+++ b/cmd/reviewdog/main_test.go
@@ -10,7 +10,7 @@ import (
 	"testing"
 
 	"github.com/reviewdog/reviewdog/commands"
-	"github.com/reviewdog/reviewdog/filter"
+	"github.com/reviewdog/reviewdog/difffilter"
 )
 
 func TestRun_local(t *testing.T) {
@@ -95,7 +95,7 @@ func TestRun_local_nofilter(t *testing.T) {
 		t.Errorf("got no error, but want error")
 	}
 
-	opt.filterMode = filter.ModeNoFilter
+	opt.filterMode = difffilter.ModeNoFilter
 	if err := run(strings.NewReader(stdin), stdout, opt); err != nil {
 		t.Error(err)
 	}
diff --git a/comment_iowriter_test.go b/comment_iowriter_test.go
index 8b6a3047..2105c3ab 100644
--- a/comment_iowriter_test.go
+++ b/comment_iowriter_test.go
@@ -6,7 +6,6 @@ import (
 	"strings"
 	"testing"
 
-	"github.com/reviewdog/reviewdog/filter"
 	"github.com/reviewdog/reviewdog/proto/rdf"
 )
 
@@ -17,7 +16,7 @@ func TestUnifiedCommentWriter_Post(t *testing.T) {
 	}{
 		{
 			in: &Comment{
-				Result: &filter.FilteredDiagnostic{
+				Result: &FilteredCheck{
 					Diagnostic: &rdf.Diagnostic{Location: &rdf.Location{Path: "/path/to/file"}},
 				},
 				ToolName: "tool name",
@@ -27,7 +26,7 @@ func TestUnifiedCommentWriter_Post(t *testing.T) {
 		},
 		{
 			in: &Comment{
-				Result: &filter.FilteredDiagnostic{
+				Result: &FilteredCheck{
 					Diagnostic: &rdf.Diagnostic{Location: &rdf.Location{
 						Path: "/path/to/file",
 						Range: &rdf.Range{Start: &rdf.Position{
@@ -42,7 +41,7 @@ func TestUnifiedCommentWriter_Post(t *testing.T) {
 		},
 		{
 			in: &Comment{
-				Result: &filter.FilteredDiagnostic{
+				Result: &FilteredCheck{
 					Diagnostic: &rdf.Diagnostic{Location: &rdf.Location{
 						Path: "/path/to/file",
 						Range: &rdf.Range{Start: &rdf.Position{
@@ -57,7 +56,7 @@ func TestUnifiedCommentWriter_Post(t *testing.T) {
 		},
 		{
 			in: &Comment{
-				Result: &filter.FilteredDiagnostic{
+				Result: &FilteredCheck{
 					Diagnostic: &rdf.Diagnostic{Location: &rdf.Location{
 						Path: "/path/to/file",
 						Range: &rdf.Range{Start: &rdf.Position{
diff --git a/comment_test.go b/comment_test.go
index b16547f5..d9e64216 100644
--- a/comment_test.go
+++ b/comment_test.go
@@ -6,7 +6,6 @@ import (
 	"strings"
 	"testing"
 
-	"github.com/reviewdog/reviewdog/filter"
 	"github.com/reviewdog/reviewdog/proto/rdf"
 )
 
@@ -17,7 +16,7 @@ func TestMultiCommentService_Post(t *testing.T) {
 
 	const want = "line1\nline2"
 
-	c := &Comment{Result: &filter.FilteredDiagnostic{Diagnostic: &rdf.Diagnostic{OriginalOutput: want}}}
+	c := &Comment{Result: &FilteredCheck{Diagnostic: &rdf.Diagnostic{OriginalOutput: want}}}
 	if err := w.Post(context.Background(), c); err != nil {
 		t.Fatal(err)
 	}
diff --git a/filter/diff_filter_test.go b/difffilter/filter_test.go
similarity index 95%
rename from filter/diff_filter_test.go
rename to difffilter/filter_test.go
index ea04860c..5a7840dd 100644
--- a/filter/diff_filter_test.go
+++ b/difffilter/filter_test.go
@@ -1,4 +1,4 @@
-package filter
+package difffilter
 
 import (
 	"os"
@@ -58,8 +58,8 @@ const sampleDiffRoot = `--- a/sample.old.txt	2016-10-13 05:09:35.820791185 +0900
 \ No newline at end of file
 `
 
-const sampleDiffSubDir = `--- a/filter/sample.old.txt	2016-10-13 05:09:35.820791185 +0900
-+++ b/filter/sample.new.txt	2016-10-13 05:15:26.839245048 +0900
+const sampleDiffSubDir = `--- a/difffilter/sample.old.txt	2016-10-13 05:09:35.820791185 +0900
++++ b/difffilter/sample.new.txt	2016-10-13 05:15:26.839245048 +0900
 @@ -1,3 +1,4 @@
  unchanged, contextual line
 -deleted line
@@ -210,7 +210,7 @@ func TestDiffFilter_root(t *testing.T) {
 		},
 	}
 	for _, tt := range tests {
-		df := NewDiffFilter(files, 1, getCwd(), tt.mode)
+		df := New(files, 1, getCwd(), tt.mode)
 		if got, gotFile, gotLine := df.ShouldReport(tt.path, tt.lnum); got != tt.want ||
 			(gotFile != nil) != tt.wantFileDiff ||
 			(gotLine != nil) != tt.wantLineDiff {
@@ -267,7 +267,7 @@ func TestDiffFilter_subdir(t *testing.T) {
 		},
 	}
 	for _, tt := range tests {
-		df := NewDiffFilter(files, 1, getCwd(), tt.mode)
+		df := New(files, 1, getCwd(), tt.mode)
 		if got, gotFile, gotLine := df.ShouldReport(tt.path, tt.lnum); got != tt.want ||
 			(gotFile != nil) != tt.wantFileDiff ||
 			(gotLine != nil) != tt.wantLineDiff {
diff --git a/doghouse/server/doghouse_test.go b/doghouse/server/doghouse_test.go
index e41db45d..bd919804 100644
--- a/doghouse/server/doghouse_test.go
+++ b/doghouse/server/doghouse_test.go
@@ -9,8 +9,8 @@ import (
 	"github.com/google/go-cmp/cmp"
 	"github.com/google/go-github/v32/github"
 
+	"github.com/reviewdog/reviewdog/difffilter"
 	"github.com/reviewdog/reviewdog/doghouse"
-	"github.com/reviewdog/reviewdog/filter"
 	"github.com/reviewdog/reviewdog/proto/rdf"
 )
 
@@ -274,7 +274,7 @@ func TestCheck_OK(t *testing.T) {
 	}
 }
 
-func testOutsideDiff(t *testing.T, outsideDiff bool, filterMode filter.Mode) {
+func testOutsideDiff(t *testing.T, outsideDiff bool, filterMode difffilter.Mode) {
 	const (
 		name        = "haya14busa-linter"
 		owner       = "haya14busa"
@@ -371,10 +371,10 @@ func testOutsideDiff(t *testing.T, outsideDiff bool, filterMode filter.Mode) {
 
 func TestCheck_OK_deprecated_outsidediff(t *testing.T) {
 	t.Run("deprecated: outside_diff", func(t *testing.T) {
-		testOutsideDiff(t, true, filter.ModeDefault)
+		testOutsideDiff(t, true, difffilter.ModeDefault)
 	})
 	t.Run("filter-mode=NoFilter", func(t *testing.T) {
-		testOutsideDiff(t, false, filter.ModeNoFilter)
+		testOutsideDiff(t, false, difffilter.ModeNoFilter)
 	})
 }
 
diff --git a/filter/filter_test.go b/filter_test.go
similarity index 95%
rename from filter/filter_test.go
rename to filter_test.go
index 9113e8f4..8c01c73b 100644
--- a/filter/filter_test.go
+++ b/filter_test.go
@@ -1,4 +1,4 @@
-package filter
+package reviewdog
 
 import (
 	"strings"
@@ -8,6 +8,7 @@ import (
 	"google.golang.org/protobuf/testing/protocmp"
 
 	"github.com/reviewdog/reviewdog/diff"
+	"github.com/reviewdog/reviewdog/difffilter"
 	"github.com/reviewdog/reviewdog/proto/rdf"
 )
 
@@ -80,7 +81,7 @@ func TestFilterCheckByAddedLines(t *testing.T) {
 			},
 		},
 	}
-	want := []*FilteredDiagnostic{
+	want := []*FilteredCheck{
 		{
 			Diagnostic: &rdf.Diagnostic{
 				Location: &rdf.Location{
@@ -152,7 +153,7 @@ func TestFilterCheckByAddedLines(t *testing.T) {
 		},
 	}
 	filediffs, _ := diff.ParseMultiFile(strings.NewReader(diffContent))
-	got := FilterCheck(results, filediffs, 0, "", ModeAdded)
+	got := FilterCheck(results, filediffs, 0, "", difffilter.ModeAdded)
 	if diff := cmp.Diff(got, want, protocmp.Transform()); diff != "" {
 		t.Error(diff)
 	}
@@ -180,7 +181,7 @@ func TestFilterCheckByDiffContext(t *testing.T) {
 			},
 		},
 	}
-	want := []*FilteredDiagnostic{
+	want := []*FilteredCheck{
 		{
 			Diagnostic: &rdf.Diagnostic{
 				Location: &rdf.Location{
@@ -222,7 +223,7 @@ func TestFilterCheckByDiffContext(t *testing.T) {
 		},
 	}
 	filediffs, _ := diff.ParseMultiFile(strings.NewReader(diffContent))
-	got := FilterCheck(results, filediffs, 0, "", ModeDiffContext)
+	got := FilterCheck(results, filediffs, 0, "", difffilter.ModeDiffContext)
 	if diff := cmp.Diff(got, want, protocmp.Transform()); diff != "" {
 		t.Error(diff)
 	}
@@ -230,7 +231,7 @@ func TestFilterCheckByDiffContext(t *testing.T) {
 
 func findFileDiff(filediffs []*diff.FileDiff, path string, strip int) *diff.FileDiff {
 	for _, file := range filediffs {
-		if NormalizeDiffPath(file.PathNew, strip) == path {
+		if difffilter.NormalizeDiffPath(file.PathNew, strip) == path {
 			return file
 		}
 	}
diff --git a/project/run_test.go b/project/run_test.go
index e03fb3eb..ea4342e5 100644
--- a/project/run_test.go
+++ b/project/run_test.go
@@ -9,7 +9,7 @@ import (
 	"testing"
 
 	"github.com/reviewdog/reviewdog"
-	"github.com/reviewdog/reviewdog/filter"
+	"github.com/reviewdog/reviewdog/difffilter"
 )
 
 type fakeDiffService struct {
@@ -39,7 +39,7 @@ func TestRun(t *testing.T) {
 
 	t.Run("empty", func(t *testing.T) {
 		conf := &Config{}
-		if err := Run(ctx, conf, nil, nil, nil, false, filter.ModeAdded, false); err != nil {
+		if err := Run(ctx, conf, nil, nil, nil, false, difffilter.ModeAdded, false); err != nil {
 			t.Error(err)
 		}
 	})
@@ -50,7 +50,7 @@ func TestRun(t *testing.T) {
 				"test": {},
 			},
 		}
-		if err := Run(ctx, conf, nil, nil, nil, false, filter.ModeAdded, false); err == nil {
+		if err := Run(ctx, conf, nil, nil, nil, false, difffilter.ModeAdded, false); err == nil {
 			t.Error("want error, got nil")
 		} else {
 			t.Log(err)
@@ -71,7 +71,7 @@ func TestRun(t *testing.T) {
 				},
 			},
 		}
-		if err := Run(ctx, conf, nil, nil, ds, false, filter.ModeAdded, false); err == nil {
+		if err := Run(ctx, conf, nil, nil, ds, false, difffilter.ModeAdded, false); err == nil {
 			t.Error("want error, got nil")
 		} else {
 			t.Log(err)
@@ -99,7 +99,7 @@ func TestRun(t *testing.T) {
 				},
 			},
 		}
-		if err := Run(ctx, conf, nil, cs, ds, false, filter.ModeAdded, false); err != nil {
+		if err := Run(ctx, conf, nil, cs, ds, false, difffilter.ModeAdded, false); err != nil {
 			t.Error(err)
 		}
 		want := ""
@@ -129,7 +129,7 @@ func TestRun(t *testing.T) {
 				},
 			},
 		}
-		if err := Run(ctx, conf, nil, cs, ds, false, filter.ModeAdded, false); err == nil {
+		if err := Run(ctx, conf, nil, cs, ds, false, difffilter.ModeAdded, false); err == nil {
 			t.Error("want error, got nil")
 		} else {
 			t.Log(err)
@@ -157,7 +157,7 @@ func TestRun(t *testing.T) {
 				},
 			},
 		}
-		if err := Run(ctx, conf, nil, cs, ds, true, filter.ModeAdded, false); err == nil {
+		if err := Run(ctx, conf, nil, cs, ds, true, difffilter.ModeAdded, false); err == nil {
 			t.Error("want error, got nil")
 		} else {
 			t.Log(err)
@@ -187,7 +187,7 @@ func TestRun(t *testing.T) {
 				},
 			},
 		}
-		if err := Run(ctx, conf, nil, cs, ds, false, filter.ModeAdded, false); err != nil {
+		if err := Run(ctx, conf, nil, cs, ds, false, difffilter.ModeAdded, false); err != nil {
 			t.Error(err)
 		}
 	})
@@ -213,7 +213,7 @@ func TestRun(t *testing.T) {
 				},
 			},
 		}
-		if err := Run(ctx, conf, nil, cs, ds, true, filter.ModeAdded, false); err != nil {
+		if err := Run(ctx, conf, nil, cs, ds, true, difffilter.ModeAdded, false); err != nil {
 			t.Error(err)
 		}
 		want := "hi\n"
@@ -249,7 +249,7 @@ func TestRun(t *testing.T) {
 				},
 			},
 		}
-		if err := Run(ctx, conf, map[string]bool{"test2": true}, cs, ds, false, filter.ModeAdded, false); err != nil {
+		if err := Run(ctx, conf, map[string]bool{"test2": true}, cs, ds, false, difffilter.ModeAdded, false); err != nil {
 			t.Error(err)
 		}
 		if called != 1 {
@@ -282,7 +282,7 @@ func TestRun(t *testing.T) {
 				},
 			},
 		}
-		if err := Run(ctx, conf, map[string]bool{"hoge": true}, cs, ds, false, filter.ModeAdded, false); err == nil {
+		if err := Run(ctx, conf, map[string]bool{"hoge": true}, cs, ds, false, difffilter.ModeAdded, false); err == nil {
 			t.Error("got no error but want runner not found error")
 		}
 	})
diff --git a/reviewdog_test.go b/reviewdog_test.go
index 127d1136..f53f7f86 100644
--- a/reviewdog_test.go
+++ b/reviewdog_test.go
@@ -7,7 +7,7 @@ import (
 	"testing"
 
 	"github.com/reviewdog/errorformat"
-	"github.com/reviewdog/reviewdog/filter"
+	"github.com/reviewdog/reviewdog/difffilter"
 	"github.com/reviewdog/reviewdog/parser"
 )
 
@@ -49,7 +49,7 @@ golint.new.go:11:1: comment on exported function F2 should be of the form "F2 ..
 	p := parser.NewErrorformatParser(efm)
 	c := NewRawCommentWriter(os.Stdout)
 	d := NewDiffString(difftext, 1)
-	app := NewReviewdog("tool name", p, c, d, filter.ModeAdded, false)
+	app := NewReviewdog("tool name", p, c, d, difffilter.ModeAdded, false)
 	app.Run(context.Background(), strings.NewReader(lintresult))
 	// Unordered output:
 	// golint.new.go:5:5: exported var NewError1 should have comment or be unexported
@@ -95,7 +95,7 @@ index 34cacb9..a727dd3 100644
 	efm, _ := errorformat.NewErrorformat([]string{`%f:%l:%c: %m`})
 	p := parser.NewErrorformatParser(efm)
 	d := NewDiffString(difftext, 1)
-	app := NewReviewdog("tool name", p, c, d, filter.ModeAdded, false)
+	app := NewReviewdog("tool name", p, c, d, difffilter.ModeAdded, false)
 	app.Run(context.Background(), strings.NewReader(lintresult))
 }
 
@@ -128,7 +128,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 := parser.NewErrorformatParser(efm)
 	d := NewDiffString(difftext, 1)
-	app := NewReviewdog("tool name", p, c, d, filter.ModeAdded, false)
+	app := NewReviewdog("tool name", p, c, d, difffilter.ModeAdded, false)
 	err := app.Run(context.Background(), strings.NewReader(lintresult))
 
 	if err != nil {
@@ -164,7 +164,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 := parser.NewErrorformatParser(efm)
 	d := NewDiffString(difftext, 1)
-	app := NewReviewdog("tool name", p, c, d, filter.ModeAdded, true)
+	app := NewReviewdog("tool name", p, c, d, difffilter.ModeAdded, true)
 	err := app.Run(context.Background(), strings.NewReader(lintresult))
 
 	if err != nil && err.Error() != "input data has violations" {
diff --git a/service/gerrit/change_review_test.go b/service/gerrit/change_review_test.go
index 0fbfd0b6..6bfd8189 100644
--- a/service/gerrit/change_review_test.go
+++ b/service/gerrit/change_review_test.go
@@ -11,7 +11,6 @@ import (
 
 	"github.com/google/go-cmp/cmp"
 	"github.com/reviewdog/reviewdog"
-	"github.com/reviewdog/reviewdog/filter"
 	"github.com/reviewdog/reviewdog/proto/rdf"
 	"golang.org/x/build/gerrit"
 )
@@ -30,7 +29,7 @@ func TestChangeReviewCommenter_Post_Flush(t *testing.T) {
 	ctx := context.Background()
 	newLnum1 := 14
 	newComment1 := &reviewdog.Comment{
-		Result: &filter.FilteredDiagnostic{
+		Result: &reviewdog.FilteredCheck{
 			Diagnostic: &rdf.Diagnostic{
 				Location: &rdf.Location{
 					Path: "file.go",
@@ -45,7 +44,7 @@ func TestChangeReviewCommenter_Post_Flush(t *testing.T) {
 	}
 	newLnum2 := 15
 	newComment2 := &reviewdog.Comment{
-		Result: &filter.FilteredDiagnostic{
+		Result: &reviewdog.FilteredCheck{
 			Diagnostic: &rdf.Diagnostic{
 				Location: &rdf.Location{
 					Path: "file2.go",
@@ -59,7 +58,7 @@ func TestChangeReviewCommenter_Post_Flush(t *testing.T) {
 		Body: "new comment 2",
 	}
 	commentOutsideDiff := &reviewdog.Comment{
-		Result: &filter.FilteredDiagnostic{
+		Result: &reviewdog.FilteredCheck{
 			Diagnostic: &rdf.Diagnostic{
 				Location: &rdf.Location{
 					Path: "file3.go",
diff --git a/service/github/github_test.go b/service/github/github_test.go
index 911aef68..d646c3a7 100644
--- a/service/github/github_test.go
+++ b/service/github/github_test.go
@@ -15,7 +15,6 @@ import (
 	"golang.org/x/oauth2"
 
 	"github.com/reviewdog/reviewdog"
-	"github.com/reviewdog/reviewdog/filter"
 	"github.com/reviewdog/reviewdog/proto/rdf"
 	"github.com/reviewdog/reviewdog/service/commentutil"
 )
@@ -72,7 +71,7 @@ func TestGitHubPullRequest_Post(t *testing.T) {
 		t.Fatal(err)
 	}
 	comment := &reviewdog.Comment{
-		Result: &filter.FilteredDiagnostic{
+		Result: &reviewdog.FilteredCheck{
 			Diagnostic: &rdf.Diagnostic{
 				Location: &rdf.Location{
 					Path: "watchdogs.go",
@@ -294,7 +293,7 @@ func TestGitHubPullRequest_Post_Flush_review_api(t *testing.T) {
 	}
 	comments := []*reviewdog.Comment{
 		{
-			Result: &filter.FilteredDiagnostic{
+			Result: &reviewdog.FilteredCheck{
 				Diagnostic: &rdf.Diagnostic{
 					Location: &rdf.Location{
 						Path: "reviewdog.go",
@@ -310,7 +309,7 @@ func TestGitHubPullRequest_Post_Flush_review_api(t *testing.T) {
 			Body: "already commented",
 		},
 		{
-			Result: &filter.FilteredDiagnostic{
+			Result: &reviewdog.FilteredCheck{
 				Diagnostic: &rdf.Diagnostic{
 					Location: &rdf.Location{
 						Path: "reviewdog.go",
@@ -326,7 +325,7 @@ func TestGitHubPullRequest_Post_Flush_review_api(t *testing.T) {
 			Body: "already commented 2",
 		},
 		{
-			Result: &filter.FilteredDiagnostic{
+			Result: &reviewdog.FilteredCheck{
 				Diagnostic: &rdf.Diagnostic{
 					Location: &rdf.Location{
 						Path: "reviewdog.go",
@@ -342,7 +341,7 @@ func TestGitHubPullRequest_Post_Flush_review_api(t *testing.T) {
 			Body: "new comment",
 		},
 		{
-			Result: &filter.FilteredDiagnostic{
+			Result: &reviewdog.FilteredCheck{
 				Diagnostic: &rdf.Diagnostic{
 					Location: &rdf.Location{
 						Path: "reviewdog.go",
@@ -361,7 +360,7 @@ func TestGitHubPullRequest_Post_Flush_review_api(t *testing.T) {
 			Body: "multiline existing comment",
 		},
 		{
-			Result: &filter.FilteredDiagnostic{
+			Result: &reviewdog.FilteredCheck{
 				Diagnostic: &rdf.Diagnostic{
 					Location: &rdf.Location{
 						Path: "reviewdog.go",
@@ -382,7 +381,7 @@ func TestGitHubPullRequest_Post_Flush_review_api(t *testing.T) {
 			Body: "multiline existing comment (line-break)",
 		},
 		{
-			Result: &filter.FilteredDiagnostic{
+			Result: &reviewdog.FilteredCheck{
 				Diagnostic: &rdf.Diagnostic{
 					Location: &rdf.Location{
 						Path: "reviewdog.go",
@@ -401,7 +400,7 @@ func TestGitHubPullRequest_Post_Flush_review_api(t *testing.T) {
 			Body: "multiline new comment",
 		},
 		{
-			Result: &filter.FilteredDiagnostic{
+			Result: &reviewdog.FilteredCheck{
 				Diagnostic: &rdf.Diagnostic{
 					Location: &rdf.Location{
 						Path: "reviewdog.go",
@@ -466,7 +465,7 @@ func TestGitHubPullRequest_Post_toomany(t *testing.T) {
 	var comments []*reviewdog.Comment
 	for i := 0; i < 100; i++ {
 		comments = append(comments, &reviewdog.Comment{
-			Result: &filter.FilteredDiagnostic{
+			Result: &reviewdog.FilteredCheck{
 				Diagnostic: &rdf.Diagnostic{
 					Location: &rdf.Location{
 						Path: "reviewdog.go",
@@ -512,7 +511,7 @@ func TestGitHubPullRequest_workdir(t *testing.T) {
 	}
 	ctx := context.Background()
 	want := "a/b/c"
-	g.Post(ctx, &reviewdog.Comment{Result: &filter.FilteredDiagnostic{
+	g.Post(ctx, &reviewdog.Comment{Result: &reviewdog.FilteredCheck{
 		Diagnostic: &rdf.Diagnostic{Location: &rdf.Location{Path: want}}}})
 	if got := g.postComments[0].Result.Diagnostic.GetLocation().GetPath(); got != want {
 		t.Errorf("wd=%q path=%q, want %q", g.wd, got, want)
@@ -528,7 +527,7 @@ func TestGitHubPullRequest_workdir(t *testing.T) {
 	}
 	path := "a/b/c"
 	wantPath := "cmd/" + path
-	g.Post(ctx, &reviewdog.Comment{Result: &filter.FilteredDiagnostic{
+	g.Post(ctx, &reviewdog.Comment{Result: &reviewdog.FilteredCheck{
 		Diagnostic: &rdf.Diagnostic{Location: &rdf.Location{Path: want}}}})
 	if got := g.postComments[0].Result.Diagnostic.GetLocation().GetPath(); got != wantPath {
 		t.Errorf("wd=%q path=%q, want %q", g.wd, got, wantPath)
diff --git a/service/gitlab/gitlab_mr_commit_test.go b/service/gitlab/gitlab_mr_commit_test.go
index 8a99f02f..73dfff1b 100644
--- a/service/gitlab/gitlab_mr_commit_test.go
+++ b/service/gitlab/gitlab_mr_commit_test.go
@@ -12,7 +12,6 @@ import (
 	"github.com/xanzy/go-gitlab"
 
 	"github.com/reviewdog/reviewdog"
-	"github.com/reviewdog/reviewdog/filter"
 	"github.com/reviewdog/reviewdog/proto/rdf"
 	"github.com/reviewdog/reviewdog/service/commentutil"
 )
@@ -93,7 +92,7 @@ func TestGitLabMergeRequestCommitCommenter_Post_Flush_review_api(t *testing.T) {
 	// If setting exists file path, sha is changed by last commit id.
 	comments := []*reviewdog.Comment{
 		{
-			Result: &filter.FilteredDiagnostic{
+			Result: &reviewdog.FilteredCheck{
 				Diagnostic: &rdf.Diagnostic{
 					Location: &rdf.Location{
 						Path: "notExistFile.go",
@@ -107,7 +106,7 @@ func TestGitLabMergeRequestCommitCommenter_Post_Flush_review_api(t *testing.T) {
 			Body: "already commented",
 		},
 		{
-			Result: &filter.FilteredDiagnostic{
+			Result: &reviewdog.FilteredCheck{
 				Diagnostic: &rdf.Diagnostic{
 					Location: &rdf.Location{
 						Path: "notExistFile.go",
@@ -148,7 +147,7 @@ func TestGitLabPullRequest_workdir(t *testing.T) {
 	}
 	ctx := context.Background()
 	want := "a/b/c"
-	g.Post(ctx, &reviewdog.Comment{Result: &filter.FilteredDiagnostic{
+	g.Post(ctx, &reviewdog.Comment{Result: &reviewdog.FilteredCheck{
 		Diagnostic: &rdf.Diagnostic{Location: &rdf.Location{Path: want}}}})
 	if got := g.postComments[0].Result.Diagnostic.GetLocation().GetPath(); got != want {
 		t.Errorf("wd=%q path=%q, want %q", g.wd, got, want)
@@ -164,7 +163,7 @@ func TestGitLabPullRequest_workdir(t *testing.T) {
 	}
 	path := "a/b/c"
 	wantPath := "cmd/" + path
-	g.Post(ctx, &reviewdog.Comment{Result: &filter.FilteredDiagnostic{
+	g.Post(ctx, &reviewdog.Comment{Result: &reviewdog.FilteredCheck{
 		Diagnostic: &rdf.Diagnostic{Location: &rdf.Location{Path: want}}}})
 	if got := g.postComments[0].Result.Diagnostic.GetLocation().GetPath(); got != wantPath {
 		t.Errorf("wd=%q path=%q, want %q", g.wd, got, wantPath)
diff --git a/service/gitlab/gitlab_mr_discussion_test.go b/service/gitlab/gitlab_mr_discussion_test.go
index fb3cf080..227a7410 100644
--- a/service/gitlab/gitlab_mr_discussion_test.go
+++ b/service/gitlab/gitlab_mr_discussion_test.go
@@ -13,7 +13,6 @@ import (
 	"github.com/xanzy/go-gitlab"
 
 	"github.com/reviewdog/reviewdog"
-	"github.com/reviewdog/reviewdog/filter"
 	"github.com/reviewdog/reviewdog/proto/rdf"
 	"github.com/reviewdog/reviewdog/service/commentutil"
 )
@@ -24,7 +23,7 @@ func TestGitLabMergeRequestDiscussionCommenter_Post_Flush_review_api(t *testing.
 	os.Chdir("../..")
 
 	alreadyCommented1 := &reviewdog.Comment{
-		Result: &filter.FilteredDiagnostic{
+		Result: &reviewdog.FilteredCheck{
 			Diagnostic: &rdf.Diagnostic{
 				Location: &rdf.Location{
 					Path: "file.go",
@@ -38,7 +37,7 @@ func TestGitLabMergeRequestDiscussionCommenter_Post_Flush_review_api(t *testing.
 		Body: "already commented",
 	}
 	alreadyCommented2 := &reviewdog.Comment{
-		Result: &filter.FilteredDiagnostic{
+		Result: &reviewdog.FilteredCheck{
 			Diagnostic: &rdf.Diagnostic{
 				Location: &rdf.Location{
 					Path: "another/file.go",
@@ -52,7 +51,7 @@ func TestGitLabMergeRequestDiscussionCommenter_Post_Flush_review_api(t *testing.
 		Body: "already commented 2",
 	}
 	newComment1 := &reviewdog.Comment{
-		Result: &filter.FilteredDiagnostic{
+		Result: &reviewdog.FilteredCheck{
 			Diagnostic: &rdf.Diagnostic{
 				Location: &rdf.Location{
 					Path: "file.go",
@@ -66,7 +65,7 @@ func TestGitLabMergeRequestDiscussionCommenter_Post_Flush_review_api(t *testing.
 		Body: "new comment",
 	}
 	newComment2 := &reviewdog.Comment{
-		Result: &filter.FilteredDiagnostic{
+		Result: &reviewdog.FilteredCheck{
 			Diagnostic: &rdf.Diagnostic{
 				Location: &rdf.Location{
 					Path: "file2.go",
@@ -80,7 +79,7 @@ func TestGitLabMergeRequestDiscussionCommenter_Post_Flush_review_api(t *testing.
 		Body: "new comment 2",
 	}
 	newComment3 := &reviewdog.Comment{
-		Result: &filter.FilteredDiagnostic{
+		Result: &reviewdog.FilteredCheck{
 			Diagnostic: &rdf.Diagnostic{
 				Location: &rdf.Location{
 					Path: "new_file.go",
@@ -96,7 +95,7 @@ func TestGitLabMergeRequestDiscussionCommenter_Post_Flush_review_api(t *testing.
 		Body: "new comment 3",
 	}
 	commentOutsideDiff := &reviewdog.Comment{
-		Result: &filter.FilteredDiagnostic{
+		Result: &reviewdog.FilteredCheck{
 			Diagnostic: &rdf.Diagnostic{
 				Location: &rdf.Location{
 					Path: "path.go",
@@ -110,7 +109,7 @@ func TestGitLabMergeRequestDiscussionCommenter_Post_Flush_review_api(t *testing.
 		Body: "comment outside diff",
 	}
 	commentWithoutLnum := &reviewdog.Comment{
-		Result: &filter.FilteredDiagnostic{
+		Result: &reviewdog.FilteredCheck{
 			Diagnostic: &rdf.Diagnostic{
 				Location: &rdf.Location{
 					Path: "path.go",