@@ -208,29 +208,24 @@ func analyzeOrganization(ctx context.Context, org string, sampleSize, days int,
208208 return nil
209209}
210210
211- // Ledger formatting functions - all output must use these for consistency
211+ // Ledger formatting functions - all output must use these for consistency.
212212
213213// formatItemLine formats a cost breakdown line item with 4-space indent.
214- func formatItemLine (label string , cost float64 , timeUnit string , detail string ) string {
215- if cost == 0 {
214+ func formatItemLine (label string , amount float64 , timeUnit string , detail string ) string {
215+ if amount == 0 {
216216 return fmt .Sprintf (" %-30s %15s %-6s %s\n " , label , "—" , timeUnit , detail )
217217 }
218- return fmt .Sprintf (" %-30s $%14s %-6s %s\n " , label , formatWithCommas (cost ), timeUnit , detail )
218+ return fmt .Sprintf (" %-30s $%14s %-6s %s\n " , label , formatWithCommas (amount ), timeUnit , detail )
219219}
220220
221221// formatSubtotalLine formats a subtotal line with 4-space indent.
222- func formatSubtotalLine (label string , cost float64 , timeUnit string , detail string ) string {
223- return fmt .Sprintf (" %-30s $%14s %-6s %s\n " , label , formatWithCommas (cost ), timeUnit , detail )
222+ func formatSubtotalLine (amount float64 , timeUnit string , detail string ) string {
223+ return fmt .Sprintf (" %-30s $%14s %-6s %s\n " , "Subtotal" , formatWithCommas (amount ), timeUnit , detail )
224224}
225225
226226// formatSummaryLine formats a summary line (like Preventable Loss Total) with 2-space indent.
227- func formatSummaryLine (label string , cost float64 , timeUnit string , detail string ) string {
228- return fmt .Sprintf (" %-30s $%14s %-6s %s\n " , label , formatWithCommas (cost ), timeUnit , detail )
229- }
230-
231- // formatTotalLine formats a total line with 2-space indent.
232- func formatTotalLine (label string , cost float64 , timeUnit string ) string {
233- return fmt .Sprintf (" %-30s $%14s %-6s\n " , label , formatWithCommas (cost ), timeUnit )
227+ func formatSummaryLine (label string , amount float64 , timeUnit string , detail string ) string {
228+ return fmt .Sprintf (" %-30s $%14s %-6s %s\n " , label , formatWithCommas (amount ), timeUnit , detail )
234229}
235230
236231// formatSectionDivider formats the divider line under subtotals (4-space indent, 32 chars + 14 dashes).
@@ -372,7 +367,7 @@ func printExtrapolatedResults(title string, days int, ext *cost.ExtrapolatedBrea
372367 }
373368 fmt .Print (formatSectionDivider ())
374369 pct := (avgAuthorTotalCost / avgTotalCost ) * 100
375- fmt .Print (formatSubtotalLine ("Subtotal" , avgAuthorTotalCost , formatTimeUnit (avgAuthorTotalHours ), fmt .Sprintf ("(%.1f%%)" , pct )))
370+ fmt .Print (formatSubtotalLine (avgAuthorTotalCost , formatTimeUnit (avgAuthorTotalHours ), fmt .Sprintf ("(%.1f%%)" , pct )))
376371 fmt .Println ()
377372
378373 // Participants section (if any participants)
@@ -393,7 +388,7 @@ func printExtrapolatedResults(title string, days int, ext *cost.ExtrapolatedBrea
393388 fmt .Print (formatItemLine ("Context Switching" , avgParticipantContextCost , formatTimeUnit (avgParticipantContextHours ), fmt .Sprintf ("(%.1f sessions)" , avgParticipantSessions )))
394389 fmt .Print (formatSectionDivider ())
395390 participantPct := (avgParticipantTotalCost / avgTotalCost ) * 100
396- fmt .Print (formatSubtotalLine ("Subtotal" , avgParticipantTotalCost , formatTimeUnit (avgParticipantTotalHours ), fmt .Sprintf ("(%.1f%%)" , participantPct )))
391+ fmt .Print (formatSubtotalLine (avgParticipantTotalCost , formatTimeUnit (avgParticipantTotalHours ), fmt .Sprintf ("(%.1f%%)" , participantPct )))
397392 fmt .Println ()
398393 }
399394
@@ -420,7 +415,7 @@ func printExtrapolatedResults(title string, days int, ext *cost.ExtrapolatedBrea
420415 avgMergeDelayHours := avgDeliveryDelayHours + avgAutomatedUpdatesHours + avgPRTrackingHours
421416 fmt .Print (formatSectionDivider ())
422417 pct = (avgMergeDelayCost / avgTotalCost ) * 100
423- fmt .Print (formatSubtotalLine ("Subtotal" , avgMergeDelayCost , formatTimeUnit (avgMergeDelayHours ), fmt .Sprintf ("(%.1f%%)" , pct )))
418+ fmt .Print (formatSubtotalLine (avgMergeDelayCost , formatTimeUnit (avgMergeDelayHours ), fmt .Sprintf ("(%.1f%%)" , pct )))
424419 fmt .Println ()
425420
426421 // Future Costs section
@@ -454,7 +449,7 @@ func printExtrapolatedResults(title string, days int, ext *cost.ExtrapolatedBrea
454449 avgFutureHours := avgCodeChurnHours + avgFutureReviewHours + avgFutureMergeHours + avgFutureContextHours
455450 fmt .Print (formatSectionDivider ())
456451 pct = (avgFutureCost / avgTotalCost ) * 100
457- fmt .Print (formatSubtotalLine ("Subtotal" , avgFutureCost , formatTimeUnit (avgFutureHours ), fmt .Sprintf ("(%.1f%%)" , pct )))
452+ fmt .Print (formatSubtotalLine (avgFutureCost , formatTimeUnit (avgFutureHours ), fmt .Sprintf ("(%.1f%%)" , pct )))
458453 fmt .Println ()
459454 }
460455
@@ -510,7 +505,7 @@ func printExtrapolatedResults(title string, days int, ext *cost.ExtrapolatedBrea
510505 }
511506 fmt .Print (formatSectionDivider ())
512507 pct = (ext .AuthorTotalCost / ext .TotalCost ) * 100
513- fmt .Print (formatSubtotalLine ("Subtotal" , ext .AuthorTotalCost , formatTimeUnit (ext .AuthorTotalHours ), fmt .Sprintf ("(%.1f%%)" , pct )))
508+ fmt .Print (formatSubtotalLine (ext .AuthorTotalCost , formatTimeUnit (ext .AuthorTotalHours ), fmt .Sprintf ("(%.1f%%)" , pct )))
514509 fmt .Println ()
515510
516511 // Participants section (extrapolated, if any participants)
@@ -526,7 +521,7 @@ func printExtrapolatedResults(title string, days int, ext *cost.ExtrapolatedBrea
526521 fmt .Print (formatItemLine ("Context Switching" , ext .ParticipantContextCost , formatTimeUnit (ext .ParticipantContextHours ), fmt .Sprintf ("(%d sessions)" , ext .ParticipantSessions )))
527522 fmt .Print (formatSectionDivider ())
528523 pct = (ext .ParticipantTotalCost / ext .TotalCost ) * 100
529- fmt .Print (formatSubtotalLine ("Subtotal" , ext .ParticipantTotalCost , formatTimeUnit (ext .ParticipantTotalHours ), fmt .Sprintf ("(%.1f%%)" , pct )))
524+ fmt .Print (formatSubtotalLine (ext .ParticipantTotalCost , formatTimeUnit (ext .ParticipantTotalHours ), fmt .Sprintf ("(%.1f%%)" , pct )))
530525 fmt .Println ()
531526 }
532527
@@ -554,7 +549,7 @@ func printExtrapolatedResults(title string, days int, ext *cost.ExtrapolatedBrea
554549 extMergeDelayHours := ext .DeliveryDelayHours + ext .CodeChurnHours + ext .AutomatedUpdatesHours + ext .PRTrackingHours
555550 fmt .Print (formatSectionDivider ())
556551 pct = (extMergeDelayCost / ext .TotalCost ) * 100
557- fmt .Print (formatSubtotalLine ("Subtotal" , extMergeDelayCost , formatTimeUnit (extMergeDelayHours ), fmt .Sprintf ("(%.1f%%)" , pct )))
552+ fmt .Print (formatSubtotalLine (extMergeDelayCost , formatTimeUnit (extMergeDelayHours ), fmt .Sprintf ("(%.1f%%)" , pct )))
558553 fmt .Println ()
559554
560555 // Future Costs section (extrapolated)
@@ -582,7 +577,7 @@ func printExtrapolatedResults(title string, days int, ext *cost.ExtrapolatedBrea
582577 extFutureHours := ext .CodeChurnHours + ext .FutureReviewHours + ext .FutureMergeHours + ext .FutureContextHours
583578 fmt .Print (formatSectionDivider ())
584579 pct = (extFutureCost / ext .TotalCost ) * 100
585- fmt .Print (formatSubtotalLine ("Subtotal" , extFutureCost , formatTimeUnit (extFutureHours ), fmt .Sprintf ("(%.1f%%)" , pct )))
580+ fmt .Print (formatSubtotalLine (extFutureCost , formatTimeUnit (extFutureHours ), fmt .Sprintf ("(%.1f%%)" , pct )))
586581 fmt .Println ()
587582 }
588583
0 commit comments