forked from reviewdog/reviewdog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
service.go
92 lines (78 loc) 路 2.91 KB
/
service.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
package doghouse
import (
"github.com/reviewdog/reviewdog/filter"
"github.com/reviewdog/reviewdog/proto/rdf"
)
// CheckRequest represents doghouse GitHub check request.
type CheckRequest struct {
// Commit SHA.
// Required.
SHA string `json:"sha,omitempty"`
// PullRequest number.
// Optional.
PullRequest int `json:"pull_request,omitempty"`
// Owner of the repository.
// Required.
Owner string `json:"owner,omitempty"`
// Repository name.
// Required.
Repo string `json:"repo,omitempty"`
// Branch name.
// Optional.
// Deprecated: No need to fill this field.
Branch string `json:"branch,omitempty"`
// Annotations associated with the repository's commit and Pull Request.
Annotations []*Annotation `json:"annotations,omitempty"`
// Name of the annotation tool.
// Optional.
Name string `json:"name,omitempty"`
// Level is report level for this request.
// One of ["info", "warning", "error"]. Default is "error".
// Optional.
Level string `json:"level"`
// Deprecated: Use FilterMode == filter.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
// empty, it will always report results all results including outside diff
// (because there are no diff!).
// Optional.
OutsideDiff bool `json:"outside_diff"`
// FilterMode represents a way to filter checks results
// Optional.
FilterMode filter.Mode `json:"filter_mode"`
}
// CheckResponse represents doghouse GitHub check response.
type CheckResponse struct {
// ReportURL is report URL of check run.
// Optional.
ReportURL string `json:"report_url,omitempty"`
// CheckedResults is checked annotations result.
// This field is expected to be filled for GitHub Actions integration and
// filled when ReportURL is not available. i.e. reviewdog doesn't have write
// permission to Check API.
// It's also not expected to be passed over network via JSON.
// TODO(haya14busa): Consider to move this type to this package to avoid
// (cyclic) import.
// Optional.
CheckedResults []*filter.FilteredDiagnostic `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
Conclusion string `json:"conclusion,omitempty"`
}
// Annotation represents an annotation to file or specific line.
type Annotation struct {
// Diagnostic.Location.Path must be relative path to the project root.
// Optional.
Diagnostic *rdf.Diagnostic `json:"diagnostic,omitempty"`
// Deprecated fields below. Need to support them for the old reviewdog CLI
// version.
// Deprecated: Use Diagnostic.
Path string `json:"path,omitempty"`
// Deprecated: Use Diagnostic.
Line int `json:"line,omitempty"`
// Deprecated: Use Diagnostic.
Message string `json:"message,omitempty"`
// Deprecated: Use Diagnostic.
RawMessage string `json:"raw_message,omitempty"`
}