@@ -16,7 +16,7 @@ import (
1616// and extrapolation - all functionality is available to external clients.
1717//
1818//nolint:revive // argument-limit: acceptable for entry point function
19- func analyzeRepository (ctx context.Context , owner , repo string , sampleSize , days int , cfg cost.Config , token , dataSource string , modelMergeTime * time. Duration ) error {
19+ func analyzeRepository (ctx context.Context , owner , repo string , sampleSize , days int , cfg cost.Config , token , dataSource string ) error {
2020 // Calculate since date
2121 since := time .Now ().AddDate (0 , 0 , - days )
2222
@@ -105,7 +105,7 @@ func analyzeRepository(ctx context.Context, owner, repo string, sampleSize, days
105105 extrapolated := cost .ExtrapolateFromSamples (breakdowns , len (prs ), totalAuthors , openPRCount , actualDays , cfg )
106106
107107 // Display results in itemized format
108- printExtrapolatedResults (fmt .Sprintf ("%s/%s" , owner , repo ), actualDays , & extrapolated , cfg , * modelMergeTime )
108+ printExtrapolatedResults (fmt .Sprintf ("%s/%s" , owner , repo ), actualDays , & extrapolated , cfg )
109109
110110 return nil
111111}
@@ -115,7 +115,7 @@ func analyzeRepository(ctx context.Context, owner, repo string, sampleSize, days
115115// and extrapolation - all functionality is available to external clients.
116116//
117117//nolint:revive // argument-limit: acceptable for entry point function
118- func analyzeOrganization (ctx context.Context , org string , sampleSize , days int , cfg cost.Config , token , dataSource string , modelMergeTime * time. Duration ) error {
118+ func analyzeOrganization (ctx context.Context , org string , sampleSize , days int , cfg cost.Config , token , dataSource string ) error {
119119 slog .Info ("Fetching PR list from organization" )
120120
121121 // Calculate since date
@@ -207,7 +207,7 @@ func analyzeOrganization(ctx context.Context, org string, sampleSize, days int,
207207 extrapolated := cost .ExtrapolateFromSamples (breakdowns , len (prs ), totalAuthors , totalOpenPRs , actualDays , cfg )
208208
209209 // Display results in itemized format
210- printExtrapolatedResults (fmt .Sprintf ("%s (organization)" , org ), actualDays , & extrapolated , cfg , * modelMergeTime )
210+ printExtrapolatedResults (fmt .Sprintf ("%s (organization)" , org ), actualDays , & extrapolated , cfg )
211211
212212 return nil
213213}
@@ -278,7 +278,7 @@ func formatTimeUnit(hours float64) string {
278278// printExtrapolatedResults displays extrapolated cost breakdown in itemized format.
279279//
280280//nolint:maintidx,revive // acceptable complexity/length for comprehensive display function
281- func printExtrapolatedResults (title string , days int , ext * cost.ExtrapolatedBreakdown , cfg cost.Config , modelMergeTime time. Duration ) {
281+ func printExtrapolatedResults (title string , days int , ext * cost.ExtrapolatedBreakdown , cfg cost.Config ) {
282282 fmt .Println ()
283283 fmt .Printf (" %s\n " , title )
284284 avgOpenTime := formatTimeUnit (ext .AvgPRDurationHours )
@@ -614,11 +614,11 @@ func printExtrapolatedResults(title string, days int, ext *cost.ExtrapolatedBrea
614614 fmt .Println ()
615615
616616 // Print extrapolated efficiency score + annual waste
617- printExtrapolatedEfficiency (ext , days , cfg , modelMergeTime )
617+ printExtrapolatedEfficiency (ext , days , cfg )
618618}
619619
620620// printExtrapolatedEfficiency prints the workflow efficiency + annual waste section for extrapolated totals.
621- func printExtrapolatedEfficiency (ext * cost.ExtrapolatedBreakdown , days int , cfg cost.Config , modelMergeTime time. Duration ) {
621+ func printExtrapolatedEfficiency (ext * cost.ExtrapolatedBreakdown , days int , cfg cost.Config ) {
622622 // Calculate preventable waste: Code Churn + All Delay Costs + Automated Updates + PR Tracking
623623 preventableHours := ext .CodeChurnHours + ext .DeliveryDelayHours + ext .AutomatedUpdatesHours + ext .PRTrackingHours
624624 preventableCost := ext .CodeChurnCost + ext .DeliveryDelayCost + ext .AutomatedUpdatesCost + ext .PRTrackingCost
@@ -676,14 +676,14 @@ func printExtrapolatedEfficiency(ext *cost.ExtrapolatedBreakdown, days int, cfg
676676 fmt .Println ()
677677
678678 // Print merge time modeling callout if average PR duration exceeds model merge time
679- if ext .AvgPRDurationHours > modelMergeTime . Hours () {
680- printExtrapolatedMergeTimeModelingCallout (ext , days , modelMergeTime , cfg )
679+ if ext .AvgPRDurationHours > cfg . TargetMergeTimeHours {
680+ printExtrapolatedMergeTimeModelingCallout (ext , days , cfg )
681681 }
682682}
683683
684684// printExtrapolatedMergeTimeModelingCallout prints a callout showing potential savings from reduced merge time.
685- func printExtrapolatedMergeTimeModelingCallout (ext * cost.ExtrapolatedBreakdown , days int , targetMergeTime time. Duration , cfg cost.Config ) {
686- targetHours := targetMergeTime . Hours ()
685+ func printExtrapolatedMergeTimeModelingCallout (ext * cost.ExtrapolatedBreakdown , days int , cfg cost.Config ) {
686+ targetHours := cfg . TargetMergeTimeHours
687687
688688 // Calculate hourly rate
689689 hourlyRate := (cfg .AnnualSalary * cfg .BenefitsMultiplier ) / cfg .HoursPerYear
@@ -702,7 +702,7 @@ func printExtrapolatedMergeTimeModelingCallout(ext *cost.ExtrapolatedBreakdown,
702702
703703 // PR tracking: scales with open time
704704 remodelPRTrackingPerPR := 0.0
705- if targetHours >= 1.0 { // Only track PRs open >= 1 hour
705+ if targetHours >= 1.0 { // Minimal tracking for PRs open >= 1 hour
706706 daysOpen := targetHours / 24.0
707707 remodelPRTrackingHours := (cfg .PRTrackingMinutesPerDay / 60.0 ) * daysOpen
708708 remodelPRTrackingPerPR = remodelPRTrackingHours * hourlyRate
0 commit comments