Merge pull request #302 from fschaefer/master · boyter/scc@d2cc1d3

@@ -818,8 +818,11 @@ func fileSummarizeLong(input chan *FileJob) string {

818818

str.WriteString(getTabularWideBreak())

819819820820

if !Cocomo {

821-

calculateCocomo(sumCode, &str)

822-

str.WriteString(getTabularWideBreak())

821+

if SLOCCountFormat {

822+

calcolateCocomoSLOCCount(sumCode, &str)

823+

} else {

824+

calculateCocomo(sumCode, &str)

825+

}

823826

}

824827

if !Size {

825828

calculateSize(sumBytes, &str)

@@ -970,7 +973,11 @@ func fileSummarizeShort(input chan *FileJob) string {

970973

str.WriteString(getTabularShortBreak())

971974972975

if !Cocomo {

973-

calculateCocomo(sumCode, &str)

976+

if SLOCCountFormat {

977+

calcolateCocomoSLOCCount(sumCode, &str)

978+

} else {

979+

calculateCocomo(sumCode, &str)

980+

}

974981

str.WriteString(getTabularShortBreak())

975982

}

976983

if !Size {

@@ -987,6 +994,24 @@ func trimNameShort(summary LanguageSummary, trimmedName string) string {

987994

return trimmedName

988995

}

989996997+

func calcolateCocomoSLOCCount(sumCode int64, str *strings.Builder) {

998+

estimatedEffort := EstimateEffort(int64(sumCode), EAF)

999+

estimatedScheduleMonths := EstimateScheduleMonths(estimatedEffort)

1000+

estimatedPeopleRequired := estimatedEffort / estimatedScheduleMonths

1001+

estimatedCost := EstimateCost(estimatedEffort, AverageWage, Overhead)

1002+1003+

p := gmessage.NewPrinter(language.Make(os.Getenv("LANG")))

1004+1005+

str.WriteString(p.Sprintf("Total Physical Source Lines of Code (SLOC) = %d\n", sumCode))

1006+

str.WriteString(p.Sprintf("Development Effort Estimate, Person-Years (Person-Months) = %.2f (%.2f)\n", estimatedEffort/12, estimatedEffort))

1007+

str.WriteString(p.Sprintf(" (Basic COCOMO model, Person-Months = %.2f*(KSLOC**%.2f)*%.2f)\n", projectType[CocomoProjectType][0], projectType[CocomoProjectType][1], EAF))

1008+

str.WriteString(p.Sprintf("Schedule Estimate, Years (Months) = %.2f (%.2f)\n", estimatedScheduleMonths/12, estimatedScheduleMonths))

1009+

str.WriteString(p.Sprintf(" (Basic COCOMO model, Months = %.2f*(person-months**%.2f))\n", projectType[CocomoProjectType][2], projectType[CocomoProjectType][3]))

1010+

str.WriteString(p.Sprintf("Estimated Average Number of Developers (Effort/Schedule) = %.2f\n", estimatedPeopleRequired))

1011+

str.WriteString(p.Sprintf("Total Estimated Cost to Develop = %s%.0f\n", CurrencySymbol, estimatedCost))

1012+

str.WriteString(p.Sprintf(" (average salary = %s%d/year, overhead = %.2f)\n", CurrencySymbol, AverageWage, Overhead))

1013+

}

1014+9901015

func calculateCocomo(sumCode int64, str *strings.Builder) {

9911016

estimatedEffort := EstimateEffort(int64(sumCode), EAF)

9921017

estimatedCost := EstimateCost(estimatedEffort, AverageWage, Overhead)

@@ -996,11 +1021,11 @@ func calculateCocomo(sumCode int64, str *strings.Builder) {

9961021

p := gmessage.NewPrinter(language.Make(os.Getenv("LANG")))

99710229981023

str.WriteString(p.Sprintf("Estimated Cost to Develop (%s) %s%d\n", CocomoProjectType, CurrencySymbol, int64(estimatedCost)))

999-

str.WriteString(p.Sprintf("Estimated Schedule Effort (%s) %f months\n", CocomoProjectType, estimatedScheduleMonths))

1024+

str.WriteString(p.Sprintf("Estimated Schedule Effort (%s) %.2f months\n", CocomoProjectType, estimatedScheduleMonths))

10001025

if math.IsNaN(estimatedPeopleRequired) {

10011026

str.WriteString(p.Sprintf("Estimated People Required 1 Grandparent\n"))

10021027

} else {

1003-

str.WriteString(p.Sprintf("Estimated People Required (%s) %f\n", CocomoProjectType, estimatedPeopleRequired))

1028+

str.WriteString(p.Sprintf("Estimated People Required (%s) %.2f\n", CocomoProjectType, estimatedPeopleRequired))

10041029

}

10051030

}

10061031