Skip to content

Commit

Permalink
fea!: reduce contributor data
Browse files Browse the repository at this point in the history
Signed-off-by: Shiwei Zhang <shizh@microsoft.com>
  • Loading branch information
shizhMSFT committed Jul 21, 2023
1 parent 6ee6e33 commit c9e399c
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions cmd/gha/report.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,18 +174,18 @@ func printIssueSummaryTable(authors map[string]*analysis.RepositorySummary) {
nameSize = len(entry.Key)
}
}
headerFormat := fmt.Sprintf("| %%-%ds | %%-6s | %%-6s | %%-6s | %%-8s | %%-8s | %%-8s | %%-8s | %%-8s | %%-8s | %%-8s |\n", nameSize)
bodyFormat := fmt.Sprintf("| %%-%ds | %%-6d | %%-6d | %%-6d | %%-8s | %%-8s | %%-8s | %%-8s | %%-8s | %%-8s | %%-8s |\n", nameSize)
headerFormat := fmt.Sprintf("| %%-%ds | %%-6s | %%-6s | %%-6s | %%-8s | %%-8s | %%-8s | %%-8s | %%-8s |\n", nameSize)
bodyFormat := fmt.Sprintf("| %%-%ds | %%-6d | %%-6d | %%-6d | %%-8s | %%-8s | %%-8s | %%-8s | %%-8s |\n", nameSize)
fmt.Println()
fmt.Printf(headerFormat, "Author", "Total", "Open", "Closed", "Min", "Max", "Mean", "Median", "P90", "P95", "P99")
fmt.Printf("|%s|--------|--------|--------|----------|----------|----------|----------|----------|----------|----------|\n", strings.Repeat("-", nameSize+2))
fmt.Printf(headerFormat, "Author", "Total", "Open", "Closed", "Min", "Max", "Mean", "Median", "P90")
fmt.Printf("|%s|--------|--------|--------|----------|----------|----------|----------|----------|\n", strings.Repeat("-", nameSize+2))

// print body
for _, entry := range counts {
author := entry.Key
summary := authors[author].Issue
if len(summary.Durations) == 0 {
fmt.Printf(bodyFormat, author, summary.Total, summary.Open, summary.Closed, "", "", "", "", "", "", "")
fmt.Printf(bodyFormat, author, summary.Total, summary.Open, summary.Closed, "", "", "", "", "")
continue
}

Expand All @@ -196,8 +196,6 @@ func printIssueSummaryTable(authors map[string]*analysis.RepositorySummary) {
formatDuration(math.Mean(summary.Durations)),
formatDuration(math.Median(summary.Durations)),
formatDuration(math.Percentile(summary.Durations, 0.9)),
formatDuration(math.Percentile(summary.Durations, 0.95)),
formatDuration(math.Percentile(summary.Durations, 0.99)),
)
}
}
Expand All @@ -220,18 +218,18 @@ func printPullRequestSummaryTable(authors map[string]*analysis.RepositorySummary
nameSize = len(entry.Key)
}
}
headerFormat := fmt.Sprintf("| %%-%ds | %%-6s | %%-6s | %%-6s | %%-6s | %%-8s | %%-8s | %%-8s | %%-8s | %%-8s | %%-8s | %%-8s |\n", nameSize)
bodyFormat := fmt.Sprintf("| %%-%ds | %%-6d | %%-6d | %%-6d | %%-6d | %%-8s | %%-8s | %%-8s | %%-8s | %%-8s | %%-8s | %%-8s |\n", nameSize)
headerFormat := fmt.Sprintf("| %%-%ds | %%-6s | %%-6s | %%-6s | %%-6s | %%-8s | %%-8s | %%-8s | %%-8s | %%-8s |\n", nameSize)
bodyFormat := fmt.Sprintf("| %%-%ds | %%-6d | %%-6d | %%-6d | %%-6d | %%-8s | %%-8s | %%-8s | %%-8s | %%-8s |\n", nameSize)
fmt.Println()
fmt.Printf(headerFormat, "Author", "Total", "Open", "Closed", "Merged", "Min", "Max", "Mean", "Median", "P90", "P95", "P99")
fmt.Printf("|%s|--------|--------|--------|--------|----------|----------|----------|----------|----------|----------|----------|\n", strings.Repeat("-", nameSize+2))
fmt.Printf(headerFormat, "Author", "Total", "Open", "Closed", "Merged", "Min", "Max", "Mean", "Median", "P90")
fmt.Printf("|%s|--------|--------|--------|--------|----------|----------|----------|----------|----------|\n", strings.Repeat("-", nameSize+2))

// print body
for _, entry := range counts {
author := entry.Key
summary := authors[author].PullRequest
if len(summary.Durations) == 0 {
fmt.Printf(bodyFormat, author, summary.Total, summary.Open, summary.Closed, summary.Merged, "", "", "", "", "", "", "")
fmt.Printf(bodyFormat, author, summary.Total, summary.Open, summary.Closed, summary.Merged, "", "", "", "", "")
continue
}

Expand All @@ -242,8 +240,6 @@ func printPullRequestSummaryTable(authors map[string]*analysis.RepositorySummary
formatDuration(math.Mean(summary.Durations)),
formatDuration(math.Median(summary.Durations)),
formatDuration(math.Percentile(summary.Durations, 0.9)),
formatDuration(math.Percentile(summary.Durations, 0.95)),
formatDuration(math.Percentile(summary.Durations, 0.99)),
)
}
}
Expand Down

0 comments on commit c9e399c

Please sign in to comment.