Documentation ¶
Index ¶
- Constants
- Variables
- func ParamScore(param interface{}, maxValue, weight float64) float64
- func PrintScore(score Score, format string)
- type AdditionalParam
- type GitHubRepository
- func (ghr GitHubRepository) ClosedIssues() int
- func (ghr GitHubRepository) CommentFrequency(issueCount int) float64
- func (ghr GitHubRepository) CommitFrequency() float64
- func (ghr GitHubRepository) ContributorOrgs() map[string]bool
- func (ghr GitHubRepository) Contributors() int
- func (ghr GitHubRepository) CreatedSince() int
- func (ghr GitHubRepository) Dependents() int
- func (ghr GitHubRepository) RecentReleases() int
- func (ghr GitHubRepository) UpdatedIssues() int
- func (ghr GitHubRepository) UpdatedSince() int
- type Score
Constants ¶
const ( CreatedSinceWeight = 1.0 UpdatedSinceWeight = -1.0 ContributorCountWeight = 2.0 OrgCountWeight = 1.0 CommitFrequencyWeight = 1.0 RecentReleasesWeight = 0.5 ClosedIssuesWeight = 0.5 UpdatedIssuesWeight = 0.5 CommentFrequencyWeight = 1.0 DependentsCountWeight = 2.0 CreatedSinceThreshold = 120.0 UpdatedSinceThreshold = 120.0 ContributorCountThreshold = 5000.0 OrgCountThreshold = 10.0 CommitFrequencyThreshold = 1000.0 RecentReleasesThreshold = 26.0 ClosedIssuesThreshold = 5000.0 UpdatedIssuesThreshold = 5000.0 CommentFrequencyThreshold = 15.0 DependentsCountThreshold = 500000.0 TopContributorCount = 15.0 IssueLookbackDays = 90.0 ReleaseLookbackDays = 365.0 )
Variables ¶
var ( ErrRepoNotProvided error = fmt.Errorf("please provided a repo url") ErrInvalidGitHubURL error = fmt.Errorf("invalid github url") ErrRepoNotFound error = fmt.Errorf("repo not found") ErrAPIResponseError error = fmt.Errorf("github api response error, please try again") ErrCommitFrequencyBeingCalculated error = fmt.Errorf("commit frequency is being calculated by github, please try again") )
var ( ErrUnknownOutputFormat error = fmt.Errorf("unknown output format") ErrInvalidParamFormat error = fmt.Errorf("invalid param format") )
var DependentsRegex *regexp.Regexp
Functions ¶
func ParamScore ¶
func PrintScore ¶
PrintScore outputs all score values in the specified format (default, json or csv)
Types ¶
type AdditionalParam ¶
type GitHubRepository ¶
type GitHubRepository struct { R *github.Repository Error error // contains filtered or unexported fields }
GitHubRepository is an object that provides a GitHub client interface for a single repository.
func LoadRepository ¶
func LoadRepository(repoURL, token string) (GitHubRepository, error)
LoadRepository returns a GitHubRepository object from a GitHub repository URL and an authorized GitHUB personal access token.
func (GitHubRepository) ClosedIssues ¶
func (ghr GitHubRepository) ClosedIssues() int
ClosedIssues returns the number of closed repository issues.
func (GitHubRepository) CommentFrequency ¶
func (ghr GitHubRepository) CommentFrequency(issueCount int) float64
CommentFrequency returns the ratio of comments to issues.
func (GitHubRepository) CommitFrequency ¶
func (ghr GitHubRepository) CommitFrequency() float64
CommitFrequency returns the weekly average number of commits.
func (GitHubRepository) ContributorOrgs ¶
func (ghr GitHubRepository) ContributorOrgs() map[string]bool
ContributorOrgs returns a map of companies associated with each of the top contributors.
func (GitHubRepository) Contributors ¶
func (ghr GitHubRepository) Contributors() int
Contributors returns the number of all contributors.
func (GitHubRepository) CreatedSince ¶
func (ghr GitHubRepository) CreatedSince() int
CreatedSince returns the number of months since the repository was created.
func (GitHubRepository) Dependents ¶
func (ghr GitHubRepository) Dependents() int
Dependents returns the number of search results that contain the repository name as in a commit.
func (GitHubRepository) RecentReleases ¶
func (ghr GitHubRepository) RecentReleases() int
RecentReleases returns the number of recent repository releases. If none found within the number of ReleaseLookbackDays, then an estimate is calculated based on totalTags / daysSinceCreation * ReleaseLookbackDays.
func (GitHubRepository) UpdatedIssues ¶
func (ghr GitHubRepository) UpdatedIssues() int
UpdatedIssues returns the number of all repository issues.
func (GitHubRepository) UpdatedSince ¶
func (ghr GitHubRepository) UpdatedSince() int
UpdatedSince returns the number of months since the last commit.
type Score ¶
type Score struct { Name string `json:"name"` URL string `json:"url"` Language string `json:"language"` CreatedSince int `json:"created_since"` UpdatedSince int `json:"updated_since"` ContributorCount int `json:"contributor_count"` OrgCount int `json:"org_count"` CommitFrequency float64 `json:"commit_frequency"` RecentReleasesCount int `json:"recent_releases_count"` ClosedIssuesCount int `json:"closed_issues_count"` UpdatedIssuesCount int `json:"updated_issues_count"` CommentFrequency float64 `json:"comment_frequency"` DependentsCount int `json:"dependents_count"` CriticalityScore float64 `json:"criticality_score"` ScoredOn string `json:"scored_on"` }
func RepositoryStats ¶
func RepositoryStats(ghr GitHubRepository, params []string) (Score, error)