Documentation
ΒΆ
Index ΒΆ
- func RunFromResult(ctx context.Context, c CommentService, results []*rdf.Diagnostic, ...) error
- type BulkCommentService
- type Comment
- type CommentService
- type DiffCmd
- type DiffService
- type DiffString
- type EmptyDiff
- type FailLevel
- type FilteredCommentService
- type FilteredResult
- type FilteredResultMap
- type NamedCommentService
- type RDJSONCommentWriter
- type RDJSONLCommentWriter
- type RawCommentWriter
- type Result
- type ResultMap
- type Reviewdog
- type SARIFCommentWriter
- type UnifiedCommentWriter
Examples ΒΆ
Constants ΒΆ
This section is empty.
Variables ΒΆ
This section is empty.
Functions ΒΆ
func RunFromResult ΒΆ
func RunFromResult(ctx context.Context, c CommentService, results []*rdf.Diagnostic, filediffs []*diff.FileDiff, strip int, toolname string, filterMode filter.Mode, failLevel FailLevel) error
RunFromResult creates a new Reviewdog and runs it with check results.
Types ΒΆ
type BulkCommentService ΒΆ
type BulkCommentService interface {
CommentService
Flush(context.Context) error
}
BulkCommentService posts comments all at once when Flush() is called. Flush() will be called at the end of each reviewdog run.
type Comment ΒΆ
type Comment struct {
Result *filter.FilteredDiagnostic
ToolName string
}
Comment represents a reported result as a comment.
type CommentService ΒΆ
type CommentService interface {
Post(context.Context, *Comment) error
// If true, prepend Git relative directly to paths in results.
// Useful for integration with code hosting service.
ShouldPrependGitRelDir() bool
}
CommentService is an interface which posts Comment.
func MultiCommentService ΒΆ
func MultiCommentService(services ...CommentService) CommentService
MultiCommentService creates a comment service that duplicates its post to all the provided comment services.
type DiffCmd ΒΆ
type DiffCmd struct {
// contains filtered or unexported fields
}
type DiffService ΒΆ
DiffService is an interface which get diff.
func NewDiffString ΒΆ
func NewDiffString(diff string, strip int) DiffService
type DiffString ΒΆ
type DiffString struct {
// contains filtered or unexported fields
}
func (*DiffString) Strip ΒΆ
func (d *DiffString) Strip() int
type FailLevel ΒΆ added in v0.20.2
type FailLevel int
FailLevel represents enumeration of available filter modes
const ( // FailLevelDefault represents default mode, which means users doesn't specify // fail-level. Basically, it's same as FailLevelNone. FailLevelDefault FailLevel = iota // FailLevelNone - Do not fail. FailLevelNone // FailLevelAny - Fail with any severity. FailLevelAny // FailLevelInfo - Fail with info or above severity. FailLevelInfo // FailLevelWarning - Fail with warning or above severity. FailLevelWarning // FailLevelError - Fail with error or above severity. FailLevelError )
func (FailLevel) ShouldFail ΒΆ added in v0.20.2
ShouldFail returns true if reviewdog should exit with 1 with given rdf.Severity.
type FilteredCommentService ΒΆ added in v0.19.0
type FilteredCommentService interface {
CommentService
PostFiltered(context.Context, *Comment) error
}
FilteredCommentService is an interface which support posting filtered Comment.
type FilteredResult ΒΆ added in v0.9.15
type FilteredResult struct {
Level string
FilteredDiagnostic []*filter.FilteredDiagnostic
}
type FilteredResultMap ΒΆ added in v0.9.15
type FilteredResultMap struct {
// contains filtered or unexported fields
}
FilteredResultMap represents a concurrent-safe map to store Diagnostics generated by concurrent jobs.
func (*FilteredResultMap) Len ΒΆ added in v0.9.15
func (rm *FilteredResultMap) Len() int
Len returns the length of FilteredResultMap count. Len() is not yet officially not supported by Go. (ref: https://github.com/golang/go/issues/20680)
func (*FilteredResultMap) Load ΒΆ added in v0.9.15
func (rm *FilteredResultMap) Load(key string) (*FilteredResult, error)
Load fetches FilteredResult from FilteredResultMap
func (*FilteredResultMap) Range ΒΆ added in v0.9.15
func (rm *FilteredResultMap) Range(f func(key string, val *FilteredResult))
Range retrieves `key` and `values` from FilteredResultMap iteratively.
func (*FilteredResultMap) Store ΒΆ added in v0.9.15
func (rm *FilteredResultMap) Store(key string, r *FilteredResult)
Store saves a new []*FilteredCheckFilteredResult into FilteredResultMap.
type NamedCommentService ΒΆ added in v0.20.2
type NamedCommentService interface {
CommentService
SetTool(toolName string, level string)
}
NamedCommentService can set tool name and level. Useful for update tool name for each reviewdog run with reviewdog project config.
type RDJSONCommentWriter ΒΆ added in v0.19.0
type RDJSONCommentWriter struct {
// contains filtered or unexported fields
}
RDJSONCommentWriter
func NewRDJSONCommentWriter ΒΆ added in v0.19.0
func NewRDJSONCommentWriter(w io.Writer, toolName string) *RDJSONCommentWriter
func (*RDJSONCommentWriter) Flush ΒΆ added in v0.19.0
func (cw *RDJSONCommentWriter) Flush(_ context.Context) error
func (*RDJSONCommentWriter) Post ΒΆ added in v0.19.0
func (cw *RDJSONCommentWriter) Post(_ context.Context, c *Comment) error
func (*RDJSONCommentWriter) ShouldPrependGitRelDir ΒΆ added in v0.21.0
func (*RDJSONCommentWriter) ShouldPrependGitRelDir() bool
type RDJSONLCommentWriter ΒΆ added in v0.19.0
type RDJSONLCommentWriter struct {
// contains filtered or unexported fields
}
RDJSONLCommentWriter
func NewRDJSONLCommentWriter ΒΆ added in v0.19.0
func NewRDJSONLCommentWriter(w io.Writer) *RDJSONLCommentWriter
func (*RDJSONLCommentWriter) Post ΒΆ added in v0.19.0
func (cw *RDJSONLCommentWriter) Post(_ context.Context, c *Comment) error
func (*RDJSONLCommentWriter) ShouldPrependGitRelDir ΒΆ added in v0.21.0
func (*RDJSONLCommentWriter) ShouldPrependGitRelDir() bool
type RawCommentWriter ΒΆ
type RawCommentWriter struct {
// contains filtered or unexported fields
}
RawCommentWriter is comment writer which writes results to given writer without any formatting.
func NewRawCommentWriter ΒΆ
func NewRawCommentWriter(w io.Writer) *RawCommentWriter
func (*RawCommentWriter) Post ΒΆ
func (s *RawCommentWriter) Post(_ context.Context, c *Comment) error
func (*RawCommentWriter) ShouldPrependGitRelDir ΒΆ added in v0.21.0
func (*RawCommentWriter) ShouldPrependGitRelDir() bool
type Result ΒΆ added in v0.9.13
type Result struct {
Name string
Level string
Diagnostics []*rdf.Diagnostic
// Optional. Report an error of the command execution.
// Non-nil CmdErr doesn't mean failure and Diagnostics still may have
// results.
// It is common that a linter fails with non-zero exit code when it finds
// lint errors.
CmdErr error
}
func (*Result) CheckUnexpectedFailure ΒΆ added in v0.10.1
CheckUnexpectedFailure returns error on unexpected failure, if any.
type ResultMap ΒΆ
type ResultMap struct {
// contains filtered or unexported fields
}
ResultMap represents a concurrent-safe map to store Diagnostics generated by concurrent jobs.
func (*ResultMap) Len ΒΆ
Len returns the length of ResultMap count. Len() is not yet officially not supported by Go. (ref: https://github.com/golang/go/issues/20680)
type Reviewdog ΒΆ
type Reviewdog struct {
// contains filtered or unexported fields
}
Reviewdog represents reviewdog application which parses result of compiler or linter, get diff and filter the results by diff, and report filtered results.
Example ΒΆ
difftext := `diff --git a/golint.old.go b/golint.new.go
index 34cacb9..a727dd3 100644
--- a/golint.old.go
+++ b/golint.new.go
@@ -2,6 +2,12 @@ package test
var V int
+var NewError1 int
+
// invalid func comment
func F() {
}
+
+// invalid func comment2
+func F2() {
+}
`
lintresult := `golint.new.go:3:5: exported var V should have comment or be unexported
golint.new.go:5:5: exported var NewError1 should have comment or be unexported
golint.new.go:7:1: comment on exported function F should be of the form "F ..."
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)
c := NewRawCommentWriter(os.Stdout)
d := NewDiffString(difftext, 1)
app := NewReviewdog("tool name", p, c, d, filter.ModeAdded, FailLevelDefault)
app.Run(context.Background(), strings.NewReader(lintresult))
Output: golint.new.go:5:5: exported var NewError1 should have comment or be unexported golint.new.go:11:1: comment on exported function F2 should be of the form "F2 ..."
func NewReviewdog ΒΆ
func NewReviewdog(toolname string, p parser.Parser, c CommentService, d DiffService, filterMode filter.Mode, failLevel FailLevel) *Reviewdog
NewReviewdog returns a new Reviewdog.
type SARIFCommentWriter ΒΆ added in v0.19.0
type SARIFCommentWriter struct {
// contains filtered or unexported fields
}
SARIFCommentWriter
func NewSARIFCommentWriter ΒΆ added in v0.19.0
func NewSARIFCommentWriter(w io.Writer, toolName string) *SARIFCommentWriter
func (*SARIFCommentWriter) Flush ΒΆ added in v0.19.0
func (cw *SARIFCommentWriter) Flush(_ context.Context) error
func (*SARIFCommentWriter) Post ΒΆ added in v0.19.0
func (cw *SARIFCommentWriter) Post(_ context.Context, c *Comment) error
func (*SARIFCommentWriter) ShouldPrependGitRelDir ΒΆ added in v0.21.0
func (*SARIFCommentWriter) ShouldPrependGitRelDir() bool
type UnifiedCommentWriter ΒΆ
type UnifiedCommentWriter struct {
// contains filtered or unexported fields
}
UnifiedCommentWriter is comment writer which writes results to given writer in one of following unified formats.
Format:
- <file>: [<tool name>] <message>
- <file>:<lnum>: [<tool name>] <message>
- <file>:<lnum>:<col>: [<tool name>] <message>
where <message> can be multiple lines.
func NewUnifiedCommentWriter ΒΆ
func NewUnifiedCommentWriter(w io.Writer) *UnifiedCommentWriter
func (*UnifiedCommentWriter) Post ΒΆ
func (mc *UnifiedCommentWriter) Post(_ context.Context, c *Comment) error
func (*UnifiedCommentWriter) ShouldPrependGitRelDir ΒΆ added in v0.21.0
func (*UnifiedCommentWriter) ShouldPrependGitRelDir() bool
Source Files
ΒΆ
Directories
ΒΆ
| Path | Synopsis |
|---|---|
|
Package cienv provides utility for environment variable in CI services.
|
Package cienv provides utility for environment variable in CI services. |
|
cmd
|
|
|
reviewdog
command
|
|
|
Package diff provides a utility to parse unified diff.
|
Package diff provides a utility to parse unified diff. |
|
appengine
command
|
|
|
appengine/statik
Package statik contains static assets.
|
Package statik contains static assets. |
|
Package project provides utility for reviewdog execution based on project config.
|
Package project provides utility for reviewdog execution based on project config. |
|
proto
|
|
|
scripts
|
|
|
decode-metacomment
command
|
|
|
encode-metacomment
command
|
|
|
trigger-depup
module
|
|
|
service
|
|










