Documentation
¶
Overview ¶
Package repometrics provides functionality to analyze software repositories and gather metrics about their health, activity, and security status.
It can collect information from multiple sources including GitHub repositories, CNCF landscape data, and security vulnerability scans. The collected metrics provide insights into project activity, community engagement, release patterns, and security status.
The package is particularly useful for: - Evaluating project health and maintenance status - Understanding community engagement and contribution patterns - Monitoring security vulnerabilities - Analyzing release frequency and version management - Tracking project growth and adoption metrics
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Contributor ¶
type Metrics ¶
type Metrics struct {
Name string `json:"name"`
Type RepoType `json:"type"`
URL string `json:"url"`
CreatedAt *time.Time `json:"created_at"`
IsCNCF bool `json:"is_cncf"`
CNCFStatus string `json:"cncf_status"`
IsKubernetesSIG bool `json:"is_kubernetes_sig"`
BackingOrganization string `json:"backing_organization"`
License string `json:"license"`
CurrentVersion string `json:"current_version"`
Vulnerabilities []types.Vulnerability `json:"vulnerabilities"`
Stats *Stats `json:"stats"`
}
Metrics represents the metrics of a repository
func (*Metrics) ProjectAge ¶
ProjectAge returns the age of the project
func (*Metrics) ScanVulnerabilities ¶
func (*Metrics) UpdateCNCFStatus ¶
func (m *Metrics) UpdateCNCFStatus(opts UpdateCNCFOptions) error
UpdateCNCFStatus updates the CNCF status of the repository
type ReleaseMetrics ¶
func CalculateReleaseMetrics ¶
func CalculateReleaseMetrics(firstRelease, lastRelease *time.Time, totalReleases int) ReleaseMetrics
CalculateReleaseMetrics calculates the release metrics based on the first and last release dates and the total number of releases.
type Scanner ¶
type Scanner interface {
Scan() ([]types.Vulnerability, error)
}
type Stats ¶
type Stats struct {
LastCommit *time.Time `json:"last_commit"`
CommitsPerMonth6M int `json:"commits_per_month_6m"`
Contributors1Y int `json:"contributors_1y"`
FirstRelease *time.Time `json:"first_release"`
LastRelease *time.Time `json:"last_release"`
Releases int `json:"releases"`
ReleasesPerDay float64 `json:"releases_per_day"`
ReleasesPerWeek float64 `json:"releases_per_week"`
ReleasesPerMonth float64 `json:"releases_per_month"`
ReleasesPerYear float64 `json:"releases_per_year"`
OpenIssuesNow int `json:"open_issues_now"`
OpenedIssues6M int `json:"opened_issues_6m"`
ClosedIssues6M int `json:"closed_issues_6m"`
OpenedPRs6M int `json:"opened_prs_6m"`
ClosedPRs6M int `json:"closed_prs_6m"`
Likes int `json:"likes"`
Forks int `json:"forks"`
TopCommitters []Contributor `json:"top_committers"`
TopCommitters1Y []Contributor `json:"top_committers_1y"`
}
type UpdateCNCFOptions ¶
type UpdateCNCFOptions struct {
Client cncf.HTTPClient
ProjectName string
ProjectRepoURL string
ProjectHomepageURL string
}
UpdateCNCFOptions represents the options for updating the CNCF status of a
ProjectName, ProjectRepoURL, and ProjectHomepageURL are used to find the project.
The order of precedence is: 1. ProjectRepoURL 2. ProjectHomepageURL 3. ProjectName (case-insensitive)