diff --git a/SCC-OUTPUT-REPORT.html b/SCC-OUTPUT-REPORT.html index afd973433..9e4c0969c 100644 --- a/SCC-OUTPUT-REPORT.html +++ b/SCC-OUTPUT-REPORT.html @@ -13,13 +13,13 @@ Go 30 - 9280 - 1450 + 9298 + 1451 453 - 7377 + 7394 1513 - 394108 - 3897 + 394637 + 3912 processor/workers_test.go @@ -30,6 +30,16 @@ 287 32301 525 + + processor/formatters.go + + 1463 + 193 + 43 + 1227 + 277 + 44617 + 709 processor/formatters_test.go @@ -40,16 +50,6 @@ 118 33829 372 - - processor/formatters.go - - 1445 - 192 - 43 - 1210 - 277 - 44088 - 694 processor/workers.go @@ -270,16 +270,6 @@ 6 699 23 - - processor/helpers.go - - 32 - 6 - 4 - 22 - 2 - 544 - 21 processor/structs_test.go @@ -290,6 +280,16 @@ 4 517 19 + + processor/helpers.go + + 32 + 6 + 4 + 22 + 2 + 544 + 21 processor/processor_unix_test.go @@ -324,15 +324,15 @@ Total 30 - 9280 - 1450 + 9298 + 1451 453 - 7377 + 7394 1513 - 394108 - 3897 + 394637 + 3912 - Estimated Cost to Develop (organic) $220,226
Estimated Schedule Effort (organic) 7.74 months
Estimated People Required (organic) 2.53
+ Estimated Cost to Develop (organic) $220,759
Estimated Schedule Effort (organic) 7.75 months
Estimated People Required (organic) 2.53
\ No newline at end of file diff --git a/processor/formatters.go b/processor/formatters.go index f16d818b1..41274fc63 100644 --- a/processor/formatters.go +++ b/processor/formatters.go @@ -652,10 +652,12 @@ func toSqlInsert(input chan *FileJob) string { projectName = strings.Join(DirFilePaths, ",") } + var sumCode int64 str.WriteString("\nbegin transaction;") count := 0 for res := range input { count++ + sumCode += res.Code dir, _ := filepath.Split(res.Location) @@ -675,10 +677,18 @@ func toSqlInsert(input chan *FileJob) string { } str.WriteString("\ncommit;") + cost, schedule, people := esstimateCostScheduleMonths(sumCode) currentTime := time.Now() es := float64(makeTimestampMilli()-startTimeMilli) * 0.001 str.WriteString("\nbegin transaction;") - str.WriteString(fmt.Sprintf("\ninsert into metadata values('%s', '%s', %f);", currentTime.Format("2006-01-02 15:04:05"), projectName, es)) + str.WriteString(fmt.Sprintf("\ninsert into metadata values('%s', '%s', %f, %f, %f, %f);", + currentTime.Format("2006-01-02 15:04:05"), + projectName, + es, + cost, + schedule, + people, + )) str.WriteString("\ncommit;") return str.String() @@ -709,7 +719,10 @@ func toSql(input chan *FileJob) string { str.WriteString(`create table metadata ( -- github.com/boyter/scc v ` + Version + ` timestamp text, Project text, - elapsed_s real); + elapsed_s real, + estimated_cost real, + estimated_schedule_months real, + estimated_people real); create table t ( Project text , Language text , @@ -1198,10 +1211,7 @@ func calculateCocomoSLOCCount(sumCode int64, str *strings.Builder) { } func calculateCocomo(sumCode int64, str *strings.Builder) { - estimatedEffort := EstimateEffort(int64(sumCode), EAF) - estimatedCost := EstimateCost(estimatedEffort, AverageWage, Overhead) - estimatedScheduleMonths := EstimateScheduleMonths(estimatedEffort) - estimatedPeopleRequired := estimatedEffort / estimatedScheduleMonths + estimatedCost, estimatedScheduleMonths, estimatedPeopleRequired := esstimateCostScheduleMonths(sumCode) p := gmessage.NewPrinter(glanguage.Make(os.Getenv("LANG"))) @@ -1214,6 +1224,14 @@ func calculateCocomo(sumCode int64, str *strings.Builder) { } } +func esstimateCostScheduleMonths(sumCode int64) (float64, float64, float64) { + estimatedEffort := EstimateEffort(int64(sumCode), EAF) + estimatedCost := EstimateCost(estimatedEffort, AverageWage, Overhead) + estimatedScheduleMonths := EstimateScheduleMonths(estimatedEffort) + estimatedPeopleRequired := estimatedEffort / estimatedScheduleMonths + return estimatedCost, estimatedScheduleMonths, estimatedPeopleRequired +} + func calculateSize(sumBytes int64, str *strings.Builder) { var size float64