reporter

package
v0.59.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 24, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BitBucketDescription = "pint is a Prometheus rule linter/validator.\n" +
		"It will inspect all Prometheus recording and alerting rules for problems that could prevent these from working correctly.\n" +
		"Checks can be either offline (static checks using only rule definition) or online (validate rule against live Prometheus server)."
)

Variables

This section is empty.

Functions

func Submit added in v0.59.0

func Submit(ctx context.Context, s Summary, c Commenter) error

Types

type BitBucketAnnotation

type BitBucketAnnotation struct {
	Path     string `json:"path"`
	Message  string `json:"message"`
	Severity string `json:"severity"`
	Type     string `json:"type"`
	Link     string `json:"link"`
	Line     int    `json:"line"`
}

type BitBucketAnnotations

type BitBucketAnnotations struct {
	Annotations []BitBucketAnnotation `json:"annotations"`
}

type BitBucketCommentAnchor added in v0.49.0

type BitBucketCommentAnchor struct {
	LineType string `json:"lineType"`
	DiffType string `json:"diffType"`
	Path     string `json:"path"`
	Line     int    `json:"line"`
	Orphaned bool   `json:"orphaned"`
}

type BitBucketCommentAuthor added in v0.49.0

type BitBucketCommentAuthor struct {
	Name string `json:"name"`
}

type BitBucketCommentSeverityUpdate added in v0.51.0

type BitBucketCommentSeverityUpdate struct {
	Severity string `json:"severity"`
	Version  int    `json:"version"`
}

type BitBucketCommentStateUpdate added in v0.51.0

type BitBucketCommentStateUpdate struct {
	State   string `json:"state"`
	Version int    `json:"version"`
}

type BitBucketDiffHunk added in v0.49.0

type BitBucketDiffHunk struct {
	Segments []BitBucketDiffSegment `json:"segments"`
}

type BitBucketDiffLine added in v0.49.0

type BitBucketDiffLine struct {
	Source      int `json:"source"`
	Destination int `json:"destination"`
}

type BitBucketDiffSegment added in v0.49.0

type BitBucketDiffSegment struct {
	Type  string              `json:"type"`
	Lines []BitBucketDiffLine `json:"lines"`
}

type BitBucketFileDiff added in v0.49.0

type BitBucketFileDiff struct {
	Hunks []BitBucketDiffHunk `json:"hunks"`
}

type BitBucketFileDiffs added in v0.49.0

type BitBucketFileDiffs struct {
	Diffs []BitBucketFileDiff `json:"diffs"`
}

type BitBucketPath added in v0.49.0

type BitBucketPath struct {
	ToString string `json:"toString"`
}

type BitBucketPendingComment added in v0.49.0

type BitBucketPendingComment struct {
	Text     string                        `json:"text"`
	Severity string                        `json:"severity"`
	Anchor   BitBucketPendingCommentAnchor `json:"anchor"`
}

type BitBucketPendingCommentAnchor added in v0.49.0

type BitBucketPendingCommentAnchor struct {
	Path     string `json:"path,omitempty"`
	LineType string `json:"lineType,omitempty"`
	FileType string `json:"fileType,omitempty"`
	DiffType string `json:"diffType"`
	Line     int    `json:"line,omitempty"`
}

type BitBucketPullRequest added in v0.49.0

type BitBucketPullRequest struct {
	FromRef BitBucketRef `json:"fromRef"`
	ToRef   BitBucketRef `json:"toRef"`
	ID      int          `json:"id"`
	Open    bool         `json:"open"`
}

type BitBucketPullRequestActivities added in v0.49.0

type BitBucketPullRequestActivities struct {
	Values        []BitBucketPullRequestActivity `json:"values"`
	Start         int                            `json:"start"`
	NextPageStart int                            `json:"nextPageStart"`
	IsLastPage    bool                           `json:"isLastPage"`
}

type BitBucketPullRequestActivity added in v0.49.0

type BitBucketPullRequestActivity struct {
	Action        string                      `json:"action"`
	CommentAction string                      `json:"commentAction"`
	CommentAnchor BitBucketCommentAnchor      `json:"commentAnchor"`
	Comment       BitBucketPullRequestComment `json:"comment"`
}

type BitBucketPullRequestChange added in v0.49.0

type BitBucketPullRequestChange struct {
	Path BitBucketPath `json:"path"`
}

type BitBucketPullRequestChanges added in v0.49.0

type BitBucketPullRequestChanges struct {
	Values        []BitBucketPullRequestChange `json:"values"`
	Start         int                          `json:"start"`
	NextPageStart int                          `json:"nextPageStart"`
	IsLastPage    bool                         `json:"isLastPage"`
}

type BitBucketPullRequestComment added in v0.49.0

type BitBucketPullRequestComment struct {
	State    string                        `json:"state"`
	Author   BitBucketCommentAuthor        `json:"author"`
	Text     string                        `json:"text"`
	Severity string                        `json:"severity"`
	Comments []BitBucketPullRequestComment `json:"comments"`
	ID       int                           `json:"id"`
	Version  int                           `json:"version"`
	Resolved bool                          `json:"threadResolved"`
}

type BitBucketPullRequests added in v0.49.0

type BitBucketPullRequests struct {
	Values        []BitBucketPullRequest `json:"values"`
	Start         int                    `json:"start"`
	NextPageStart int                    `json:"nextPageStart"`
	IsLastPage    bool                   `json:"isLastPage"`
}

type BitBucketRef added in v0.49.0

type BitBucketRef struct {
	ID     string `json:"id"`
	Commit string `json:"latestCommit"`
}

type BitBucketReport

type BitBucketReport struct {
	Reporter string                `json:"reporter"`
	Title    string                `json:"title"`
	Result   string                `json:"result"`
	Details  string                `json:"details"`
	Link     string                `json:"link"`
	Data     []BitBucketReportData `json:"data"`
}

type BitBucketReportData added in v0.27.0

type BitBucketReportData struct {
	Value any      `json:"value"`
	Title string   `json:"title"`
	Type  DataType `json:"type"`
}

type BitBucketReporter

type BitBucketReporter struct {
	// contains filtered or unexported fields
}

BitBucketReporter send linter results to BitBucket using https://docs.atlassian.com/bitbucket-server/rest/7.8.0/bitbucket-code-insights-rest.html

func NewBitBucketReporter

func NewBitBucketReporter(version, uri string, timeout time.Duration, token, project, repo string, maxComments int, gitCmd git.CommandRunner) BitBucketReporter

func (BitBucketReporter) Submit

func (bb BitBucketReporter) Submit(summary Summary) (err error)

type Commenter added in v0.59.0

type Commenter interface {
	Describe() string
	Destinations(context.Context) ([]any, error)
	Summary(context.Context, any, Summary, []error) error
	List(context.Context, any) ([]ExistingCommentV2, error)
	Create(context.Context, any, PendingCommentV2) error
	Delete(context.Context, any, ExistingCommentV2) error
	CanCreate(int) (bool, error)
	IsEqual(ExistingCommentV2, PendingCommentV2) bool
}

type ConsoleReporter

type ConsoleReporter struct {
	// contains filtered or unexported fields
}

func NewConsoleReporter

func NewConsoleReporter(output io.Writer, minSeverity checks.Severity) ConsoleReporter

func (ConsoleReporter) Submit

func (cr ConsoleReporter) Submit(summary Summary) (err error)

type DataType added in v0.27.0

type DataType string
const (
	BooleanType    DataType = "BOOLEAN"
	DateType       DataType = "DATA"
	DurationType   DataType = "DURATION"
	LinkType       DataType = "LINK"
	NumberType     DataType = "NUMBER"
	PercentageType DataType = "PERCENTAGE"
	TextType       DataType = "TEXT"
)

type ExistingCommentV2 added in v0.59.0

type ExistingCommentV2 struct {
	// contains filtered or unexported fields
}

type GitLabReporter added in v0.59.0

type GitLabReporter struct {
	// contains filtered or unexported fields
}

func NewGitLabReporter added in v0.59.0

func NewGitLabReporter(version, branch, uri string, timeout time.Duration, token string, project, maxComments int) (_ GitLabReporter, err error)

func (GitLabReporter) CanCreate added in v0.59.0

func (gl GitLabReporter) CanCreate(done int) (bool, error)

func (GitLabReporter) Create added in v0.59.0

func (gl GitLabReporter) Create(ctx context.Context, dst any, comment PendingCommentV2) error

func (GitLabReporter) Delete added in v0.59.0

func (gl GitLabReporter) Delete(ctx context.Context, dst any, comment ExistingCommentV2) error

func (GitLabReporter) Describe added in v0.59.0

func (gl GitLabReporter) Describe() string

func (GitLabReporter) Destinations added in v0.59.0

func (gl GitLabReporter) Destinations(ctx context.Context) ([]any, error)

func (GitLabReporter) IsEqual added in v0.59.0

func (gl GitLabReporter) IsEqual(existing ExistingCommentV2, pending PendingCommentV2) bool

func (GitLabReporter) List added in v0.59.0

func (gl GitLabReporter) List(ctx context.Context, dst any) ([]ExistingCommentV2, error)

func (GitLabReporter) Submit added in v0.59.0

func (gl GitLabReporter) Submit(summary Summary) (err error)

func (GitLabReporter) Summary added in v0.59.0

func (gl GitLabReporter) Summary(ctx context.Context, dst any, s Summary, errs []error) error

type GithubReporter

type GithubReporter struct {
	// contains filtered or unexported fields
}

func NewGithubReporter

func NewGithubReporter(version, baseURL, uploadURL string, timeout time.Duration, token, owner, repo string, prNum, maxComments int, gitCmd git.CommandRunner) (_ GithubReporter, err error)

NewGithubReporter creates a new GitHub reporter that reports problems via comments on a given pull request number (integer).

func (GithubReporter) Submit

func (gr GithubReporter) Submit(summary Summary) error

Submit submits the summary to GitHub.

type PendingCommentV2 added in v0.59.0

type PendingCommentV2 struct {
	// contains filtered or unexported fields
}

type Report

type Report struct {
	Path          discovery.Path
	Owner         string
	ModifiedLines []int
	Rule          parser.Rule
	Problem       checks.Problem
}

type Reporter

type Reporter interface {
	Submit(Summary) error
}

type Summary

type Summary struct {
	OfflineChecks  int64
	OnlineChecks   int64
	Duration       time.Duration
	TotalEntries   int
	CheckedEntries int64
	// contains filtered or unexported fields
}

func NewSummary added in v0.27.0

func NewSummary(reports []Report) Summary

func (Summary) CountBySeverity

func (s Summary) CountBySeverity() map[checks.Severity]int

func (Summary) HasFatalProblems

func (s Summary) HasFatalProblems() bool

func (*Summary) Report added in v0.27.0

func (s *Summary) Report(reps ...Report)

func (Summary) Reports

func (s Summary) Reports() (reports []Report)

func (*Summary) SortReports added in v0.49.0

func (s *Summary) SortReports()

type TeamCityReporter added in v0.49.0

type TeamCityReporter struct {
	// contains filtered or unexported fields
}

func NewTeamCityReporter added in v0.49.0

func NewTeamCityReporter(output io.Writer) TeamCityReporter

func (TeamCityReporter) Submit added in v0.49.0

func (tc TeamCityReporter) Submit(summary Summary) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL