scan

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsInDateRange added in v1.6.0

func IsInDateRange(date time.Time, dateRange DateRange) bool

IsInDateRange checks if a date falls within a date range The range is inclusive of the start date and exclusive of the end date

Types

type CommitHistory added in v1.5.0

type CommitHistory struct {
	Date        time.Time `json:"date"`
	Hash        string    `json:"hash"`
	MessageHead string    `json:"message_head"`
	Author      string    `json:"author"`
	FileCount   int       `json:"file_count"`
	Additions   int       `json:"additions"`
	Deletions   int       `json:"deletions"`
}

type DailyStats added in v1.5.0

type DailyStats struct {
	Date    time.Time `json:"date"`
	Commits int       `json:"commits"`
	Lines   int       `json:"lines"`
	Files   int       `json:"files"`
}

type DateCache added in v1.6.1

type DateCache struct {
	// contains filtered or unexported fields
}

Add at the top of the file

func NewDateCache added in v1.6.1

func NewDateCache() *DateCache

func (*DateCache) Add added in v1.6.1

func (dc *DateCache) Add(dateStr string, date time.Time)

func (*DateCache) GetParsedDate added in v1.6.1

func (dc *DateCache) GetParsedDate(dateStr string) (time.Time, bool)

func (*DateCache) GetYMD added in v1.6.1

func (dc *DateCache) GetYMD(dateStr string) (string, bool)

type DateRange added in v1.6.0

type DateRange struct {
	Start time.Time
	End   time.Time
}

DateRange represents a time period with start (inclusive) and end (exclusive) dates

func GetCurrentWeekRange added in v1.6.0

func GetCurrentWeekRange() DateRange

GetCurrentWeekRange returns the date range for the current week (Monday to Sunday)

func GetMonthRange added in v1.6.0

func GetMonthRange(monthsBack int) DateRange

GetMonthRange returns the date range for the specified number of months back

func GetPreviousWeekRange added in v1.6.0

func GetPreviousWeekRange() DateRange

GetPreviousWeekRange returns the date range for the previous week (Monday to Sunday)

type RepoMetadata

type RepoMetadata struct {
	Path             string    `json:"path"`
	LastCommit       time.Time `json:"last_commit"`
	CommitCount      int       `json:"commit_count"`
	CurrentStreak    int       `json:"current_streak"`
	LongestStreak    int       `json:"longest_streak"`
	WeeklyCommits    int       `json:"weekly_commits"`
	LastWeeksCommits int       `json:"last_weeks_commits"`
	MonthlyCommits   int       `json:"monthly_commits"`
	MostActiveDay    string    `json:"most_active_day"`
	LastActivity     string    `json:"last_activity"`
	AuthorVerified   bool      `json:"author_verified"`
	Dormant          bool      `json:"dormant"`

	CommitHistory []CommitHistory       `json:"commit_history"`
	DailyStats    map[string]DailyStats `json:"daily_stats"`
	LastAnalyzed  time.Time             `json:"last_analyzed"`
	TotalLines    int                   `json:"total_lines"`
	TotalFiles    int                   `json:"total_files"`
	Languages     map[string]int        `json:"languages"`
	Contributors  map[string]int        `json:"contributors"`
}

func FetchRepoMetadata added in v1.6.3

func FetchRepoMetadata(repoPath string) RepoMetadata

FetchRepoMetadata - gets metadata for a single repository

func ScanDirectories

func ScanDirectories(dirs []string, author string, shouldExclude func(string) bool) ([]RepoMetadata, error)

ScanDirectories - scans for Git repositories in the specified directories

func (*RepoMetadata) CalculatePeakHours added in v1.5.0

func (m *RepoMetadata) CalculatePeakHours() []TimeSlot

func (*RepoMetadata) CalculateVelocity added in v1.5.0

func (m *RepoMetadata) CalculateVelocity() VelocityMetrics

func (*RepoMetadata) GetCommitTrend added in v1.5.0

func (m *RepoMetadata) GetCommitTrend(days int) map[string]int

func (*RepoMetadata) GetLanguageDistribution added in v1.5.0

func (m *RepoMetadata) GetLanguageDistribution() map[string]float64

func (*RepoMetadata) ValidateData added in v1.6.1

func (m *RepoMetadata) ValidateData() ValidationResult

type StreakInfo added in v1.3.0

type StreakInfo struct {
	Current int
	Longest int
}

Add this new function to track both current and longest streaks

type TimeSlot added in v1.5.0

type TimeSlot struct {
	Hour    int `json:"hour"`
	Commits int `json:"commits"`
	Lines   int `json:"lines"`
}

TimeSlot represents a 24-hour time period divided into slots

type ValidationResult added in v1.6.1

type ValidationResult struct {
	Valid  bool
	Issues []string
}

ValidationResult holds the results of data validation

type VelocityMetrics added in v1.5.0

type VelocityMetrics struct {
	DailyAverage float64    `json:"daily_average"`
	WeeklyTrend  float64    `json:"weekly_trend"`  // Percentage change from previous week
	MonthlyTrend float64    `json:"monthly_trend"` // Percentage change from previous month
	PeakHours    []TimeSlot `json:"peak_hours"`
}

VelocityMetrics represents coding velocity over different time periods

Jump to

Keyboard shortcuts

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