Update + signing of the binaries

This commit is contained in:
2025-12-15 00:46:20 +00:00
parent 4aab8af16f
commit 8423b6ada1
23 changed files with 269 additions and 983 deletions
-23
View File
@@ -26,26 +26,3 @@ type Commit struct {
// Derived fields
HasTests bool `json:"has_tests"`
}
// TotalChanges returns the total lines changed (additions + deletions)
func (c *Commit) TotalChanges() int {
return c.Additions + c.Deletions
}
// ShortSHA returns the first 7 characters of the SHA
func (c *Commit) ShortSHA() string {
if len(c.SHA) >= 7 {
return c.SHA[:7]
}
return c.SHA
}
// ShortMessage returns the first line of the commit message
func (c *Commit) ShortMessage() string {
for i, r := range c.Message {
if r == '\n' {
return c.Message[:i]
}
}
return c.Message
}
+8 -1
View File
@@ -63,7 +63,14 @@ type ContributorMetrics struct {
NightOwlCount int `json:"night_owl_count"` // Commits after 9pm
MidnightCount int `json:"midnight_count"` // Commits between midnight and 4am
WeekendWarrior int `json:"weekend_warrior"` // Weekend commits
OutOfHoursCount int `json:"out_of_hours_count"` // Commits outside 9am-5pm
OutOfHoursCount int `json:"out_of_hours_count"` // Commits outside 9am-5pm (legacy, kept for achievements)
// Time-based commit counts for multiplier scoring
RegularHoursCount int `json:"regular_hours_count"` // Commits 9am-5pm (x1 multiplier)
EveningCount int `json:"evening_count"` // Commits 5pm-9pm (x2 multiplier)
LateNightCount int `json:"late_night_count"` // Commits 9pm-midnight (x2.5 multiplier)
OvernightCount int `json:"overnight_count"` // Commits midnight-6am (x5 multiplier)
EarlyMorningCount int `json:"early_morning_count"` // Commits 6am-9am (x2 multiplier)
// Repository participation
RepositoriesContributed []string `json:"repositories_contributed,omitempty"`
-75
View File
@@ -45,81 +45,6 @@ func TestAuthor_DisplayName(t *testing.T) {
}
}
func TestCommit_TotalChanges(t *testing.T) {
t.Parallel()
commit := Commit{Additions: 100, Deletions: 50}
assert.Equal(t, 150, commit.TotalChanges())
}
func TestCommit_ShortSHA(t *testing.T) {
t.Parallel()
tests := []struct {
name string
sha string
expected string
}{
{
name: "full SHA",
sha: "abc123456789def",
expected: "abc1234",
},
{
name: "short SHA",
sha: "abc",
expected: "abc",
},
{
name: "exactly 7 chars",
sha: "abc1234",
expected: "abc1234",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
commit := Commit{SHA: tt.sha}
assert.Equal(t, tt.expected, commit.ShortSHA())
})
}
}
func TestCommit_ShortMessage(t *testing.T) {
t.Parallel()
tests := []struct {
name string
message string
expected string
}{
{
name: "single line",
message: "Fix bug in login",
expected: "Fix bug in login",
},
{
name: "multiline",
message: "Fix bug in login\n\nThis fixes the issue where users couldn't log in.",
expected: "Fix bug in login",
},
{
name: "empty",
message: "",
expected: "",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
commit := Commit{Message: tt.message}
assert.Equal(t, tt.expected, commit.ShortMessage())
})
}
}
func TestPullRequest_IsMerged(t *testing.T) {
t.Parallel()