legacy

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SinceDuration time.Duration = time.Hour * 24 * 30
	IssueLookback time.Duration = time.Hour * 24 * 90 * 24

	// TODO: these limits should ultimately be imposed by the score generation, not here.
	MaxContributorLimit = 5000
	MaxIssuesLimit      = 5000
	MaxTopContributors  = 15

	TooManyContributorsOrgCount = 10
	TooManyCommentsFrequency    = 2.0
)
View Source
const (
	IssueStateAll    = "all"
	IssueStateOpen   = "open"
	IssueStateClosed = "closed"
)

Variables

View Source
var ErrorTooManyResults = errors.New("too many results")

Functions

func FetchCreatedTime

func FetchCreatedTime(ctx context.Context, c *githubapi.Client, owner, name string, earliestSoFar time.Time) (time.Time, error)

FetchCreatedTime returns the earliest known creation time for a given repository based on the commit history, before or equal to earliestSoFar.

Only times before earliestSoFar will be considered. If there is no time before earliestSoFar found, the value of earliestSoFar will be returned.

func FetchIssueCommentCount

func FetchIssueCommentCount(ctx context.Context, c *githubapi.Client, owner, name string, lookback time.Duration) (int, error)

FetchIssueCommentCount returns the total number of comments for a given repo across all issues and pull requests, for the past lookback duration.

If the exact number if unable to be returned because there are too many results, a TooManyResultsError will be returned.

func FetchIssueCount

func FetchIssueCount(ctx context.Context, c *githubapi.Client, owner, name string, state IssueState, lookback time.Duration) (int, error)

FetchIssueCount returns the total number of issues for a given repo in a given state, across the past lookback duration.

This count includes both issues and pull requests.

func FetchOrgCount

func FetchOrgCount(ctx context.Context, c *githubapi.Client, owner, name string) (int, error)

FetchOrgCount returns the number of unique orgs/companies for the top MaxTopContributors of a given repository.

If there are too many contributors for the given repo, the number returned will be TooManyContributorsOrgCount.

func FetchReleaseCount

func FetchReleaseCount(ctx context.Context, c *githubapi.Client, owner, name string, lookback time.Duration) (int, error)

func FetchTotalContributors

func FetchTotalContributors(ctx context.Context, c *githubapi.Client, owner, name string) (int, error)

FetchTotalContributors returns the total number of contributors for the given repository.

Results will be capped to MaxContributorLimit.

func Round

func Round(v float64, p int) float64

Round will return v approximately rounded to a precision of p decimal places.

func TimeDelta

func TimeDelta(a, b time.Time, u time.Duration) int

Types

type IssueState

type IssueState string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL