Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a overhead commandline flag to set the multiplier for corporate overhead. #281 #298

Merged
merged 1 commit into from
Nov 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,12 @@ func main() {
56286,
"average wage value used for basic COCOMO calculation",
)
flags.Float64Var(
&processor.Overhead,
"overhead",
2.4,
"set the overhead multiplier for corporate overhead (facilities, equipment, accounting, etc.)",
)
flags.BoolVar(
&processor.Cocomo,
"no-cocomo",
Expand Down
4 changes: 2 additions & 2 deletions processor/cocomo.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ var projectType = map[string][]float64{

// EstimateCost calculates the cost in dollars applied using generic COCOMO weighted values based
// on the average yearly wage
func EstimateCost(effortApplied float64, averageWage int64) float64 {
return effortApplied * float64(averageWage/12) * 2.4
func EstimateCost(effortApplied float64, averageWage int64, overhead float64) float64 {
return effortApplied * float64(averageWage/12) * overhead
}

// EstimateEffort calculate the effort applied using generic COCOMO weighted values
Expand Down
4 changes: 2 additions & 2 deletions processor/cocomo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

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

// Should be around 582
if got < 580 || got > 585 {
Expand All @@ -18,7 +18,7 @@ func TestEstimateCost(t *testing.T) {

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

// Should be around 2602096
if got < 2602000 || got > 2602100 {
Expand Down
4 changes: 2 additions & 2 deletions processor/formatters.go
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,7 @@ func fileSummarizeLong(input chan *FileJob) string {

if !Cocomo {
estimatedEffort := EstimateEffort(int64(sumCode))
estimatedCost := EstimateCost(estimatedEffort, AverageWage)
estimatedCost := EstimateCost(estimatedEffort, AverageWage, Overhead)
estimatedScheduleMonths := EstimateScheduleMonths(estimatedEffort)
estimatedPeopleRequired := estimatedEffort / estimatedScheduleMonths

Expand Down Expand Up @@ -992,7 +992,7 @@ func trimNameShort(summary LanguageSummary, trimmedName string) string {
func calculateCocomo(sumCode int64, str *strings.Builder) {
if !Cocomo {
estimatedEffort := EstimateEffort(int64(sumCode))
estimatedCost := EstimateCost(estimatedEffort, AverageWage)
estimatedCost := EstimateCost(estimatedEffort, AverageWage, Overhead)
estimatedScheduleMonths := EstimateScheduleMonths(estimatedEffort)
estimatedPeopleRequired := estimatedEffort / estimatedScheduleMonths

Expand Down
3 changes: 3 additions & 0 deletions processor/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ var AllowListExtensions = []string{}
// AverageWage is the average wage in dollars used for the COCOMO cost estimate
var AverageWage int64 = 56286

// Overhead is the overhead multiplier for corporate overhead (facilities, equipment, accounting, etc.)
var Overhead float64 = 2.4

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