Skip to content

Commit

Permalink
Merge pull request #299 from fschaefer/master
Browse files Browse the repository at this point in the history
Add a command line argument for the effort adjustment factor.
  • Loading branch information
boyter committed Nov 1, 2021
2 parents a01003d + 89a752b commit 8a8c674
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 7 deletions.
6 changes: 6 additions & 0 deletions main.go
Expand Up @@ -114,6 +114,12 @@ func main() {
2.4,
"set the overhead multiplier for corporate overhead (facilities, equipment, accounting, etc.)",
)
flags.Float64Var(
&processor.EAF,
"eaf",
1.0,
"the effort adjustment factor derived from the cost drivers (1.0 if rated nominal)",
)
flags.BoolVar(
&processor.Cocomo,
"no-cocomo",
Expand Down
3 changes: 1 addition & 2 deletions processor/cocomo.go
Expand Up @@ -32,8 +32,7 @@ func EstimateCost(effortApplied float64, averageWage int64, overhead float64) fl
}

// EstimateEffort calculate the effort applied using generic COCOMO weighted values
func EstimateEffort(sloc int64) float64 {
var eaf float64 = 1
func EstimateEffort(sloc int64, eaf float64) float64 {
var effortApplied = projectType[CocomoProjectType][0] * math.Pow(float64(sloc)/1000, projectType[CocomoProjectType][1]) * eaf
return effortApplied
}
Expand Down
6 changes: 3 additions & 3 deletions processor/cocomo_test.go
Expand Up @@ -7,7 +7,7 @@ import (
)

func TestEstimateCost(t *testing.T) {
eff := EstimateEffort(26)
eff := EstimateEffort(26, 1)
got := EstimateCost(eff, 56000, 2.4)

// Should be around 582
Expand All @@ -17,7 +17,7 @@ func TestEstimateCost(t *testing.T) {
}

func TestEstimateCostManyLines(t *testing.T) {
eff := EstimateEffort(77873)
eff := EstimateEffort(77873, 1)
got := EstimateCost(eff, 56000, 2.4)

// Should be around 2602096
Expand All @@ -27,7 +27,7 @@ func TestEstimateCostManyLines(t *testing.T) {
}

func TestEstimateScheduleMonths(t *testing.T) {
eff := EstimateEffort(537)
eff := EstimateEffort(537, 1)
got := EstimateScheduleMonths(eff)

// Should be around 2.7
Expand Down
4 changes: 2 additions & 2 deletions processor/formatters.go
Expand Up @@ -816,7 +816,7 @@ func fileSummarizeLong(input chan *FileJob) string {
str.WriteString(getTabularWideBreak())

if !Cocomo {
estimatedEffort := EstimateEffort(int64(sumCode))
estimatedEffort := EstimateEffort(int64(sumCode), EAF)
estimatedCost := EstimateCost(estimatedEffort, AverageWage, Overhead)
estimatedScheduleMonths := EstimateScheduleMonths(estimatedEffort)
estimatedPeopleRequired := estimatedEffort / estimatedScheduleMonths
Expand Down Expand Up @@ -991,7 +991,7 @@ func trimNameShort(summary LanguageSummary, trimmedName string) string {

func calculateCocomo(sumCode int64, str *strings.Builder) {
if !Cocomo {
estimatedEffort := EstimateEffort(int64(sumCode))
estimatedEffort := EstimateEffort(int64(sumCode), EAF)
estimatedCost := EstimateCost(estimatedEffort, AverageWage, Overhead)
estimatedScheduleMonths := EstimateScheduleMonths(estimatedEffort)
estimatedPeopleRequired := estimatedEffort / estimatedScheduleMonths
Expand Down
3 changes: 3 additions & 0 deletions processor/processor.go
Expand Up @@ -148,6 +148,9 @@ var AverageWage int64 = 56286
// Overhead is the overhead multiplier for corporate overhead (facilities, equipment, accounting, etc.)
var Overhead float64 = 2.4

// the effort adjustment factor derived from the cost drivers, i.e. 1.0 if rated nominal
var EAF float64 = 1.0

// GcFileCount is the number of files to process before turning the GC back on
var GcFileCount = 10000
var gcPercent = -1
Expand Down

0 comments on commit 8a8c674

Please sign in to comment.