Documentation
¶
Index ¶
- func DefaultBotPatterns() []string
- func Validate(cfg *Config) error
- type AchievementCondition
- type AchievementConfig
- type AuthConfig
- type CacheConfig
- type Config
- func (c *Config) GetCacheTTL() (time.Duration, error)
- func (c *Config) GetCustomPeriods() ([]ParsedCustomPeriod, error)
- func (c *Config) GetGithubAppPrivateKey() ([]byte, error)
- func (c *Config) GetParsedDateRange() (*ParsedDateRange, error)
- func (c *Config) GetTeamForUser(username string) *TeamConfig
- func (c *Config) HasGithubApp() bool
- func (c *Config) HasGithubToken() bool
- func (c *Config) IsBot(username string) bool
- type CustomPeriod
- type DateRangeConfig
- type DeployConfig
- type GithubAppConfig
- type OptionsConfig
- type OutputConfig
- type ParsedCustomPeriod
- type ParsedDateRange
- type PointsConfig
- type RepositoryConfig
- type ScoringConfig
- type TeamConfig
- type UserAlias
- type ValidationError
- type ValidationErrors
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultBotPatterns ¶ added in v0.2.19
func DefaultBotPatterns() []string
DefaultBotPatterns returns the hardcoded bot patterns that are always applied These cannot be overridden by users to ensure consistent bot filtering
Types ¶
type AchievementCondition ¶
type AchievementCondition struct {
Type string `yaml:"type"` // commit_count, pr_count, review_count, avg_review_time, etc.
Threshold float64 `yaml:"threshold"`
}
AchievementCondition defines when an achievement is earned
type AchievementConfig ¶
type AchievementConfig struct {
ID string `yaml:"id"`
Name string `yaml:"name"`
Description string `yaml:"description"`
Icon string `yaml:"icon"`
Condition AchievementCondition `yaml:"condition"`
}
AchievementConfig defines an achievement badge
type AuthConfig ¶
type AuthConfig struct {
// Token-based authentication
GithubToken string `yaml:"github_token,omitempty"`
// GitHub App authentication
GithubApp *GithubAppConfig `yaml:"github_app,omitempty"`
}
AuthConfig holds authentication configuration
type CacheConfig ¶
type CacheConfig struct {
Enabled bool `yaml:"enabled"`
Directory string `yaml:"directory"`
TTL string `yaml:"ttl"` // Duration string like "24h"
}
CacheConfig holds caching configuration
type Config ¶
type Config struct {
Version string `yaml:"version"`
Auth AuthConfig `yaml:"auth"`
Repositories []RepositoryConfig `yaml:"repositories"`
DateRange DateRangeConfig `yaml:"date_range"`
Granularity []string `yaml:"granularity"`
CustomPeriods []CustomPeriod `yaml:"custom_periods,omitempty"`
Teams []TeamConfig `yaml:"teams,omitempty"`
Scoring ScoringConfig `yaml:"scoring"`
Output OutputConfig `yaml:"output"`
Cache CacheConfig `yaml:"cache"`
Options OptionsConfig `yaml:"options"`
}
Config represents the main configuration structure
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns a configuration with sensible defaults
func (*Config) GetCacheTTL ¶
GetCacheTTL returns the cache TTL as a time.Duration
func (*Config) GetCustomPeriods ¶
func (c *Config) GetCustomPeriods() ([]ParsedCustomPeriod, error)
GetCustomPeriods returns parsed custom periods
func (*Config) GetGithubAppPrivateKey ¶
GetGithubAppPrivateKey returns the GitHub App private key content
func (*Config) GetParsedDateRange ¶
func (c *Config) GetParsedDateRange() (*ParsedDateRange, error)
GetParsedDateRange parses and returns the date range with defaults Supports both absolute dates (2024-01-01) and relative dates (-90d, -2w, -3m, -1y)
func (*Config) GetTeamForUser ¶
func (c *Config) GetTeamForUser(username string) *TeamConfig
GetTeamForUser returns the team configuration for a given username
func (*Config) HasGithubApp ¶
HasGithubApp returns true if GitHub App authentication is configured
func (*Config) HasGithubToken ¶
HasGithubToken returns true if token authentication is configured
type CustomPeriod ¶
type CustomPeriod struct {
Name string `yaml:"name"`
Start string `yaml:"start"`
End string `yaml:"end"`
}
CustomPeriod defines a custom time period for analysis
type DateRangeConfig ¶
type DateRangeConfig struct {
Start string `yaml:"start,omitempty"` // ISO 8601 format
End string `yaml:"end,omitempty"` // ISO 8601 format
}
DateRangeConfig specifies the analysis time range
type DeployConfig ¶
DeployConfig specifies deployment options
type GithubAppConfig ¶
type GithubAppConfig struct {
AppID int64 `yaml:"app_id"`
InstallationID int64 `yaml:"installation_id"`
PrivateKeyPath string `yaml:"private_key_path,omitempty"`
PrivateKey string `yaml:"private_key,omitempty"`
}
GithubAppConfig holds GitHub App authentication details
type OptionsConfig ¶
type OptionsConfig struct {
ConcurrentRequests int `yaml:"concurrent_requests"`
IncludeBots bool `yaml:"include_bots"`
AdditionalBotPatterns []string `yaml:"additional_bot_patterns"` // User-defined patterns (added to hardcoded defaults)
CloneDirectory string `yaml:"clone_directory"` // Directory for local git clones
ShallowClone bool `yaml:"shallow_clone"` // Use shallow clone based on date range (faster cloning)
ShallowCloneBuffer int `yaml:"shallow_clone_buffer"` // Extra commits to fetch beyond date range (default: 100)
UseGraphQL bool `yaml:"use_graphql"` // Use GraphQL API for batched queries (fewer API calls)
UserAliases []UserAlias `yaml:"user_aliases,omitempty"` // Manual email/name to login mappings
}
OptionsConfig holds advanced options
type OutputConfig ¶
type OutputConfig struct {
Directory string `yaml:"directory"`
Format []string `yaml:"format"` // html, json
Deploy DeployConfig `yaml:"deploy"`
}
OutputConfig specifies output generation settings
type ParsedCustomPeriod ¶
ParsedCustomPeriod represents a parsed custom time period
type ParsedDateRange ¶
ParsedDateRange holds parsed date range values
type PointsConfig ¶
type PointsConfig struct {
Commit int `yaml:"commit"`
CommitWithTests int `yaml:"commit_with_tests"`
LinesAdded float64 `yaml:"lines_added"`
LinesDeleted float64 `yaml:"lines_deleted"`
PROpened int `yaml:"pr_opened"`
PRMerged int `yaml:"pr_merged"`
PRReviewed int `yaml:"pr_reviewed"`
ReviewComment int `yaml:"review_comment"` // PR review comments (not code comments)
IssueOpened int `yaml:"issue_opened"`
IssueClosed int `yaml:"issue_closed"`
IssueComment int `yaml:"issue_comment"` // Commenting on an issue
IssueReference int `yaml:"issue_reference_commit"` // Commit referencing an issue (fixes #123, etc.)
FastReview1h int `yaml:"fast_review_1h"`
FastReview4h int `yaml:"fast_review_4h"`
FastReview24h int `yaml:"fast_review_24h"`
OutOfHours int `yaml:"out_of_hours"` // Legacy: kept for backwards compatibility
// Time-based commit multipliers (applied to base commit points)
MultiplierRegularHours float64 `yaml:"multiplier_regular_hours"` // 9am-5pm (default: 1.0)
MultiplierEvening float64 `yaml:"multiplier_evening"` // 5pm-9pm (default: 2.0)
MultiplierLateNight float64 `yaml:"multiplier_late_night"` // 9pm-midnight (default: 2.5)
MultiplierOvernight float64 `yaml:"multiplier_overnight"` // midnight-6am (default: 5.0)
MultiplierEarlyMorning float64 `yaml:"multiplier_early_morning"` // 6am-9am (default: 2.0)
}
PointsConfig defines point values for various activities
type RepositoryConfig ¶
type RepositoryConfig struct {
Owner string `yaml:"owner"`
Name string `yaml:"name,omitempty"`
Pattern string `yaml:"pattern,omitempty"` // For wildcard matching
}
RepositoryConfig defines a repository to analyze
type ScoringConfig ¶
type ScoringConfig struct {
Enabled bool `yaml:"enabled"`
Points PointsConfig `yaml:"points"`
}
ScoringConfig holds gamification scoring configuration
func (*ScoringConfig) GetAchievements ¶ added in v0.2.19
func (s *ScoringConfig) GetAchievements() []AchievementConfig
GetAchievements returns the hardcoded achievements (not configurable to prevent manipulation)
type TeamConfig ¶
type TeamConfig struct {
Name string `yaml:"name"`
Members []string `yaml:"members"`
Color string `yaml:"color,omitempty"`
}
TeamConfig defines a team and its members
type UserAlias ¶
type UserAlias struct {
GithubLogin string `yaml:"github_login"` // The canonical GitHub username
Emails []string `yaml:"emails,omitempty"` // Git commit emails to map
Names []string `yaml:"names,omitempty"` // Git commit author names to map
}
UserAlias maps git emails or names to a GitHub login
type ValidationError ¶
ValidationError represents a configuration validation error
func (ValidationError) Error ¶
func (e ValidationError) Error() string
type ValidationErrors ¶
type ValidationErrors []ValidationError
ValidationErrors is a collection of validation errors
func (ValidationErrors) Error ¶
func (e ValidationErrors) Error() string