Documentation
¶
Index ¶
- Constants
- Variables
- func Generate(ctx context.Context, lang string, wr io.Writer) error
- type Badge
- func (b *Badge) CodeToTestRatioColor(ratio float64) (string, error)
- func (b *Badge) CoverageColor(cover float64) (string, error)
- func (b *Badge) RenderCodeToTestRatio(w io.Writer, ratio float64) error
- func (b *Badge) RenderCoverage(w io.Writer, cover float64) error
- func (b *Badge) RenderTestExecutionTime(w io.Writer, nano float64) error
- func (b *Badge) TestExecutionTimeColor(d time.Duration) (string, error)
- func (b *Badge) Validate(normalize func(string) (string, error)) error
- type BadgeColor
- type Body
- type Central
- type CentralBadges
- type CentralReports
- type CodeToTestRatio
- type Comment
- type Config
- func (c *Config) Acceptable(r, rPrev Reporter, pc *cov.PatchCoverage) error
- func (c *Config) BodyConfigReady() error
- func (c *Config) Build()
- func (c *Config) CentralConfigReady() error
- func (c *Config) CentralPushConfigReady() error
- func (c *Config) CentralReReportReady() error
- func (c *Config) CheckIf(cond string) (bool, error)
- func (c *Config) CodeToTestRatioBadgeConfigReady() error
- func (c *Config) CodeToTestRatioColor(ratio float64) string
- func (c *Config) CodeToTestRatioConfigReady() error
- func (c *Config) CommentConfigReady() error
- func (c *Config) CoverageBadgeConfigReady() error
- func (c *Config) CoverageColor(cover float64) string
- func (c *Config) CoverageConfigReady() error
- func (c *Config) CoverageConfigReadyOnLocal() error
- func (c *Config) CustomLinks() (*CustomLinks, error)
- func (c *Config) DiffConfigReady() error
- func (c *Config) Load(path string) error
- func (c *Config) Loaded() bool
- func (c *Config) PushConfigReady() error
- func (c *Config) ReportConfigReady() error
- func (c *Config) ReportConfigTargetReady() error
- func (c *Config) ResolveCentralViewer(ctx context.Context) ViewerType
- func (c *Config) ResolveViewer(ctx context.Context) ViewerType
- func (c *Config) Root() string
- func (c *Config) Setwd(path string)
- func (c *Config) SummaryConfigReady() error
- func (c *Config) TestExecutionTimeBadgeConfigReady() error
- func (c *Config) TestExecutionTimeColor(d time.Duration) string
- func (c *Config) TestExecutionTimeConfigReady() error
- func (c *Config) UnmarshalYAML(data []byte) error
- func (c *Config) Wd() string
- type Coverage
- type CustomLinks
- type Diff
- type Push
- type Report
- type Reporter
- type Summary
- type TestExecutionTime
- type Viewer
- type ViewerLinks
- type ViewerType
Constants ¶
const ( LinkCoverage = "coverage" LinkCoverageFile = "coverageFile" LinkCodeToTestRatio = "codeToTestRatio" LinkTestExecutionTime = "testExecutionTime" )
The keys of `viewer.links:`, one for each kind of value a table can link.
Variables ¶
var Paths = internal.ConfigPaths
Functions ¶
Types ¶
type Badge ¶ added in v0.80.0
type Badge struct {
Path string `yaml:"path,omitempty"`
Label string `yaml:"label,omitempty"`
LabelColor string `yaml:"labelColor,omitempty"`
Icon string `yaml:"icon,omitempty"`
Colors []BadgeColor `yaml:"colors,omitempty"`
// contains filtered or unexported fields
}
Badge is the configuration of a report badge.
func (*Badge) CodeToTestRatioColor ¶ added in v0.80.0
CodeToTestRatioColor returns the message color of the code to test ratio badge.
func (*Badge) CoverageColor ¶ added in v0.80.0
CoverageColor returns the message color of the coverage badge.
func (*Badge) RenderCodeToTestRatio ¶ added in v0.80.0
RenderCodeToTestRatio renders the badge of a measured code to test ratio to w.
func (*Badge) RenderCoverage ¶ added in v0.80.0
RenderCoverage renders the badge of a measured coverage to w.
func (*Badge) RenderTestExecutionTime ¶ added in v0.80.0
RenderTestExecutionTime renders the badge of a measured test execution time, in nanoseconds, to w.
func (*Badge) TestExecutionTimeColor ¶ added in v0.80.0
TestExecutionTimeColor returns the message color of the test execution time badge.
func (*Badge) Validate ¶ added in v0.80.0
Validate validates the whole badge configuration, the conditions and the icon included, without a measured value. It is the up-front check of a central mode run, where a badge that cannot be rendered is worth hearing about before every datastore has been walked rather than after. normalize reads a condition the way the metric this badge belongs to writes one.
type BadgeColor ¶ added in v0.80.0
BadgeColor is a message color of a badge and the condition it is picked by.
type Central ¶ added in v0.49.0
type Central struct {
Root string `yaml:"root"`
Reports CentralReports `yaml:"reports"`
Badges CentralBadges `yaml:"badges"`
Push *Push `yaml:"push,omitempty"`
ReReport *Report `yaml:"reReport,omitempty"`
If string `yaml:"if,omitempty"`
}
func (*Central) UnmarshalYAML ¶ added in v0.49.0
type CentralBadges ¶ added in v0.49.0
type CentralReports ¶ added in v0.49.0
type CentralReports struct {
Datastores []string `yaml:"datastores"`
}
type CodeToTestRatio ¶ added in v0.49.0
type Comment ¶ added in v0.49.0
type Comment struct {
// HideCoverageLink is removed in favor of `viewer: none`, and read only to say so.
HideCoverageLink bool `yaml:"hideCoverageLink"`
ExpandDetails bool `yaml:"expandDetails"`
DeletePrevious bool `yaml:"deletePrevious"`
UpdatePrevious bool `yaml:"updatePrevious"`
Message string `yaml:"message,omitempty"`
If string `yaml:"if,omitempty"`
}
type Config ¶
type Config struct {
Repository string `yaml:"repository"`
Coverage *Coverage `yaml:"coverage"`
CodeToTestRatio *CodeToTestRatio `yaml:"codeToTestRatio,omitempty"`
TestExecutionTime *TestExecutionTime `yaml:"testExecutionTime,omitempty"`
Report *Report `yaml:"report,omitempty"`
Central *Central `yaml:"central,omitempty"`
Push *Push `yaml:"push,omitempty"`
Comment *Comment `yaml:"comment,omitempty"`
Summary *Summary `yaml:"summary,omitempty"`
Body *Body `yaml:"body,omitempty"`
Diff *Diff `yaml:"diff,omitempty"`
Viewer *Viewer `yaml:"viewer,omitempty"`
Timeout time.Duration `yaml:"timeout,omitempty"`
Locale *language.Tag `yaml:"locale,omitempty"`
GitRoot string `yaml:"-"`
// contains filtered or unexported fields
}
func (*Config) Acceptable ¶ added in v0.8.0
func (c *Config) Acceptable(r, rPrev Reporter, pc *cov.PatchCoverage) error
Acceptable checks r (and rPrev, for comparison) against the configured acceptable conditions. pc is the already measured patch coverage, used for the `patch` variable of `coverage.acceptable:`. Pass nil if it could not be measured; `patch` then falls back to defaultPatchCoverage, and the condition is still evaluated.
Patch coverage is passed in already measured rather than computed here, because it is derived from the block coverages, which the caller shrinks away once the report has been stored.
func (*Config) BodyConfigReady ¶ added in v0.43.0
func (*Config) CentralConfigReady ¶ added in v0.2.0
func (*Config) CentralPushConfigReady ¶ added in v0.9.0
func (*Config) CentralReReportReady ¶ added in v0.45.0
func (*Config) CodeToTestRatioBadgeConfigReady ¶ added in v0.6.0
func (*Config) CodeToTestRatioColor ¶ added in v0.6.0
CodeToTestRatioColor returns the color of a measured code to test ratio by the built-in thresholds.
func (*Config) CodeToTestRatioConfigReady ¶ added in v0.12.0
func (*Config) CommentConfigReady ¶ added in v0.11.0
func (*Config) CoverageBadgeConfigReady ¶ added in v0.6.0
func (*Config) CoverageColor ¶ added in v0.2.0
CoverageColor returns the color of a measured coverage by the built-in thresholds. It is the color of the metric itself rather than of a badge, which is what `octocov ls-files` paints a listing with. A badge resolves its own color through Badge.CoverageColor, since `colors:` describes one badge rather than what a coverage figure means.
func (*Config) CoverageConfigReady ¶ added in v0.12.0
func (*Config) CoverageConfigReadyOnLocal ¶ added in v0.59.0
func (*Config) CustomLinks ¶ added in v0.81.0
func (c *Config) CustomLinks() (*CustomLinks, error)
CustomLinks returns the expressions of `viewer.links:` bound to the variables `if:` has, or nil when the viewer is not a custom one.
func (*Config) DiffConfigReady ¶ added in v0.20.0
func (*Config) PushConfigReady ¶ added in v0.9.0
func (*Config) ReportConfigReady ¶ added in v0.14.0
func (*Config) ReportConfigTargetReady ¶ added in v0.20.1
func (*Config) ResolveCentralViewer ¶ added in v0.81.0
func (c *Config) ResolveCentralViewer(ctx context.Context) ViewerType
ResolveCentralViewer returns the viewer the badges of the central mode link to. The reports it collects are named by the central repository, so its visibility stands in for theirs when `viewer:` is not set.
func (*Config) ResolveViewer ¶ added in v0.81.0
func (c *Config) ResolveViewer(ctx context.Context) ViewerType
ResolveViewer returns the viewer the tables link to. When `viewer:` is not set, a public repository on github.com whose report is stored in an artifact links to octocov.dev, since there it asks nothing of a reader, and everything else links to the page rendered into an artifact.
func (*Config) SummaryConfigReady ¶ added in v0.42.0
func (*Config) TestExecutionTimeBadgeConfigReady ¶ added in v0.7.0
func (*Config) TestExecutionTimeColor ¶ added in v0.7.0
TestExecutionTimeColor returns the color of a measured test execution time by the built-in thresholds.
func (*Config) TestExecutionTimeConfigReady ¶ added in v0.12.0
func (*Config) UnmarshalYAML ¶ added in v0.38.0
type Coverage ¶ added in v0.49.0
type Coverage struct {
Path string `yaml:"path,omitempty"`
Paths []string `yaml:"paths,omitempty"`
Exclude []string `yaml:"exclude,omitempty"`
Badge Badge `yaml:"badge,omitempty"`
Acceptable string `yaml:"acceptable,omitempty"`
If string `yaml:"if,omitempty"`
}
func (*Coverage) AcceptableReferencesPatch ¶ added in v0.76.0
AcceptableReferencesPatch reports whether the `coverage.acceptable:` condition references the `patch` variable.
type CustomLinks ¶ added in v0.81.0
type CustomLinks struct {
// contains filtered or unexported fields
}
CustomLinks evaluates the expressions of `viewer.links:`.
type TestExecutionTime ¶ added in v0.49.0
type Viewer ¶ added in v0.81.0
type Viewer struct {
Type ViewerType `yaml:"type"`
Links *ViewerLinks `yaml:"links,omitempty"`
// contains filtered or unexported fields
}
Viewer says where the values in the tables link to.
func (*Viewer) CustomLinks ¶ added in v0.81.0
func (v *Viewer) CustomLinks(vars map[string]any) *CustomLinks
CustomLinks returns the expressions of `viewer.links:` bound to vars.
func (*Viewer) UnmarshalYAML ¶ added in v0.81.0
UnmarshalYAML reads a viewer written as its type alone, which is shorthand for a map holding only `type`.
type ViewerLinks ¶ added in v0.81.0
type ViewerType ¶ added in v0.81.0
type ViewerType string
const ( ViewerOctocovDev ViewerType = "octocov.dev" ViewerArtifact ViewerType = "artifact" ViewerNone ViewerType = "none" ViewerCustom ViewerType = "custom" )