Documentation
¶
Index ¶
- Constants
- func Submit(ctx context.Context, s Summary, c Commenter, showDuplicates bool) error
- type BitBucketAnnotation
- type BitBucketAnnotations
- type BitBucketCommentAnchor
- type BitBucketCommentAuthor
- type BitBucketCommentSeverityUpdate
- type BitBucketCommentStateUpdate
- type BitBucketDiffHunk
- type BitBucketDiffLine
- type BitBucketDiffSegment
- type BitBucketFileDiff
- type BitBucketFileDiffs
- type BitBucketPath
- type BitBucketPendingComment
- type BitBucketPendingCommentAnchor
- type BitBucketPullRequest
- type BitBucketPullRequestActivities
- type BitBucketPullRequestActivity
- type BitBucketPullRequestChange
- type BitBucketPullRequestChanges
- type BitBucketPullRequestComment
- type BitBucketPullRequests
- type BitBucketRef
- type BitBucketReport
- type BitBucketReportData
- type BitBucketReporter
- type CheckStyleReporter
- type CommentReporter
- type Commenter
- type ConsoleReporter
- type DataType
- type DisabledChecks
- type ExistingComment
- type GitLabReporter
- func (gl GitLabReporter) CanCreate(done int) bool
- func (gl GitLabReporter) CanDelete(ExistingComment) bool
- func (gl GitLabReporter) Create(ctx context.Context, dst any, comment PendingComment) error
- func (gl GitLabReporter) Delete(ctx context.Context, dst any, comment ExistingComment) error
- func (gl GitLabReporter) Describe() string
- func (gl GitLabReporter) Destinations(ctx context.Context) ([]any, error)
- func (gl GitLabReporter) IsEqual(_ any, existing ExistingComment, pending PendingComment) bool
- func (gl GitLabReporter) List(_ context.Context, dst any) ([]ExistingComment, error)
- func (gl GitLabReporter) Summary(ctx context.Context, dst any, s Summary, pendingComments []PendingComment, ...) (err error)
- type GithubReporter
- func (gr GithubReporter) CanCreate(done int) bool
- func (gr GithubReporter) CanDelete(ExistingComment) bool
- func (gr GithubReporter) Create(ctx context.Context, _ any, p PendingComment) error
- func (gr GithubReporter) Delete(_ context.Context, _ any, _ ExistingComment) error
- func (gr GithubReporter) Describe() string
- func (gr GithubReporter) Destinations(_ context.Context) ([]any, error)
- func (gr GithubReporter) IsEqual(_ any, existing ExistingComment, pending PendingComment) bool
- func (gr GithubReporter) List(ctx context.Context, _ any) ([]ExistingComment, error)
- func (gr GithubReporter) Summary(ctx context.Context, _ any, s Summary, pendingComments []PendingComment, ...) error
- type JSONReport
- type JSONReporter
- type PendingComment
- type PrometheusDetails
- type Report
- type Reporter
- type Summary
- func (s Summary) CountBySeverity() map[checks.Severity]int
- func (s *Summary) Dedup()
- func (s *Summary) GetPrometheusDetails() []PrometheusDetails
- func (s Summary) HasFatalProblems() bool
- func (s *Summary) MarkCheckDisabled(prom, api string, checks []string)
- func (s *Summary) Report(reps ...Report)
- func (s Summary) Reports() (reports []Report)
- func (s Summary) ReportsPerPath() (reports [][]Report)
- func (s *Summary) SortReports()
- type TeamCityReporter
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 ¶
Types ¶
type BitBucketAnnotation ¶
type BitBucketAnnotations ¶
type BitBucketAnnotations struct {
Annotations []BitBucketAnnotation `json:"annotations"`
}
type BitBucketCommentAnchor ¶ added in v0.49.0
type BitBucketCommentAuthor ¶ added in v0.49.0
type BitBucketCommentAuthor struct {
Name string `json:"name"`
}
type BitBucketCommentSeverityUpdate ¶ added in v0.51.0
type BitBucketCommentStateUpdate ¶ added in v0.51.0
type BitBucketDiffHunk ¶ added in v0.49.0
type BitBucketDiffHunk struct {
Segments []BitBucketDiffSegment `json:"segments"`
}
type BitBucketDiffLine ¶ added in v0.49.0
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 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 BitBucketReport ¶
type BitBucketReportData ¶ added in v0.27.0
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, showDuplicates bool, gitCmd git.CommandRunner) BitBucketReporter
type CheckStyleReporter ¶ added in v0.67.0
type CheckStyleReporter struct {
// contains filtered or unexported fields
}
func NewCheckStyleReporter ¶ added in v0.67.0
func NewCheckStyleReporter(output io.Writer) CheckStyleReporter
type CommentReporter ¶ added in v0.63.0
type CommentReporter struct {
// contains filtered or unexported fields
}
func NewCommentReporter ¶ added in v0.63.0
func NewCommentReporter(c Commenter, showDuplicates bool) CommentReporter
type Commenter ¶ added in v0.59.0
type Commenter interface {
Describe() string
Destinations(context.Context) ([]any, error)
Summary(context.Context, any, Summary, []PendingComment, []error) error
List(context.Context, any) ([]ExistingComment, error)
Create(context.Context, any, PendingComment) error
Delete(context.Context, any, ExistingComment) error
CanCreate(int) bool
CanDelete(ExistingComment) bool
IsEqual(any, ExistingComment, PendingComment) bool
}
type ConsoleReporter ¶
type ConsoleReporter struct {
// contains filtered or unexported fields
}
func NewConsoleReporter ¶
type DisabledChecks ¶ added in v0.70.0
type ExistingComment ¶ added in v0.63.0
type ExistingComment 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 (GitLabReporter) CanCreate ¶ added in v0.59.0
func (gl GitLabReporter) CanCreate(done int) bool
func (GitLabReporter) CanDelete ¶ added in v0.63.0
func (gl GitLabReporter) CanDelete(ExistingComment) bool
func (GitLabReporter) Create ¶ added in v0.59.0
func (gl GitLabReporter) Create(ctx context.Context, dst any, comment PendingComment) error
func (GitLabReporter) Delete ¶ added in v0.59.0
func (gl GitLabReporter) Delete(ctx context.Context, dst any, comment ExistingComment) 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(_ any, existing ExistingComment, pending PendingComment) bool
func (GitLabReporter) List ¶ added in v0.59.0
func (gl GitLabReporter) List(_ context.Context, dst any) ([]ExistingComment, error)
func (GitLabReporter) Summary ¶ added in v0.59.0
func (gl GitLabReporter) Summary(ctx context.Context, dst any, s Summary, pendingComments []PendingComment, errs []error) (err error)
type GithubReporter ¶
type GithubReporter struct {
// contains filtered or unexported fields
}
func NewGithubReporter ¶
func NewGithubReporter( ctx context.Context, version, baseURL, uploadURL string, timeout time.Duration, token, owner, repo string, prNum, maxComments int, headCommit string, showDuplicates bool, ) (_ GithubReporter, err error)
NewGithubReporter creates a new GitHub reporter that reports problems via comments on a given pull request number (integer).
func (GithubReporter) CanCreate ¶ added in v0.63.0
func (gr GithubReporter) CanCreate(done int) bool
func (GithubReporter) CanDelete ¶ added in v0.63.0
func (gr GithubReporter) CanDelete(ExistingComment) bool
func (GithubReporter) Create ¶ added in v0.63.0
func (gr GithubReporter) Create(ctx context.Context, _ any, p PendingComment) error
func (GithubReporter) Delete ¶ added in v0.63.0
func (gr GithubReporter) Delete(_ context.Context, _ any, _ ExistingComment) error
func (GithubReporter) Describe ¶ added in v0.63.0
func (gr GithubReporter) Describe() string
func (GithubReporter) Destinations ¶ added in v0.63.0
func (gr GithubReporter) Destinations(_ context.Context) ([]any, error)
func (GithubReporter) IsEqual ¶ added in v0.63.0
func (gr GithubReporter) IsEqual(_ any, existing ExistingComment, pending PendingComment) bool
func (GithubReporter) List ¶ added in v0.63.0
func (gr GithubReporter) List(ctx context.Context, _ any) ([]ExistingComment, error)
func (GithubReporter) Summary ¶ added in v0.63.0
func (gr GithubReporter) Summary(ctx context.Context, _ any, s Summary, pendingComments []PendingComment, errs []error) error
type JSONReport ¶ added in v0.67.0
type JSONReporter ¶ added in v0.67.0
type JSONReporter struct {
// contains filtered or unexported fields
}
func NewJSONReporter ¶ added in v0.67.0
func NewJSONReporter(output io.Writer) JSONReporter
type PendingComment ¶ added in v0.63.0
type PendingComment struct {
// contains filtered or unexported fields
}
type PrometheusDetails ¶ added in v0.70.0
type PrometheusDetails struct {
Name string
DisabledChecks []DisabledChecks
}
type Report ¶
type Report struct {
Path discovery.Path
Owner string
Changes *discovery.Changes
Duplicates []*Report
Rule parser.Rule
Problem checks.Problem
IsDuplicate bool
}
func (Report) MarshalXML ¶ added in v0.67.0
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 (*Summary) GetPrometheusDetails ¶ added in v0.70.0
func (s *Summary) GetPrometheusDetails() []PrometheusDetails
func (Summary) HasFatalProblems ¶
func (*Summary) MarkCheckDisabled ¶ added in v0.70.0
func (Summary) ReportsPerPath ¶ added in v0.69.0
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
Click to show internal directories.
Click to hide internal directories.