reporter

package
v0.49.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2023 License: Apache-2.0 Imports: 21 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

This section is empty.

Types

type BitBucketAnnotation

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

type BitBucketAnnotations

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

type BitBucketCommentAnchor added in v0.49.0

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

type BitBucketCommentAuthor added in v0.49.0

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

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"`
	Line     int    `json:"line"`
	LineType string `json:"lineType"`
	FileType string `json:"fileType"`
	DiffType string `json:"diffType"`
}

type BitBucketPullRequest added in v0.49.0

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

type BitBucketPullRequestActivities added in v0.49.0

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

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 {
	Start         int                          `json:"start"`
	NextPageStart int                          `json:"nextPageStart"`
	IsLastPage    bool                         `json:"isLastPage"`
	Values        []BitBucketPullRequestChange `json:"values"`
}

type BitBucketPullRequestComment added in v0.49.0

type BitBucketPullRequestComment struct {
	ID      int                    `json:"id"`
	Version int                    `json:"version"`
	State   string                 `json:"state"`
	Author  BitBucketCommentAuthor `json:"author"`
	Text    string                 `json:"text"`
}

type BitBucketPullRequests added in v0.49.0

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

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 {
	Title string   `json:"title"`
	Type  DataType `json:"type"`
	Value any      `json:"value"`
}

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, gitCmd git.CommandRunner) BitBucketReporter

func (BitBucketReporter) Submit

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

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) 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 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 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 Report

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

type Reporter

type Reporter interface {
	Submit(Summary) error
}

type Summary

type Summary struct {
	OfflineChecks int64
	OnlineChecks  int64
	Duration      time.Duration
	Entries       int
	// 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