From 5acb76c93e3fa92f83d0c9c8bbf2c9a192bd5ee9 Mon Sep 17 00:00:00 2001 From: apocelipes Date: Tue, 27 Aug 2024 06:38:10 +0800 Subject: [PATCH] fix: fix concurrent map read and map write on ulocLanguageCount (#499) Fixes #498. --- SCC-OUTPUT-REPORT.html | 100 ++++++++++++++++++++-------------------- processor/formatters.go | 5 +- 2 files changed, 53 insertions(+), 52 deletions(-) diff --git a/SCC-OUTPUT-REPORT.html b/SCC-OUTPUT-REPORT.html index 10ff8275c..3cd46d946 100644 --- a/SCC-OUTPUT-REPORT.html +++ b/SCC-OUTPUT-REPORT.html @@ -13,23 +13,23 @@ Go 30 - 9518 + 9519 1461 456 - 7601 + 7602 1517 - 254263 + 253980 4051 processor/formatters.go - 1605 + 1606 208 43 - 1354 + 1355 289 - 48017 - 793 + 48000 + 794 processor/workers_test.go @@ -38,7 +38,7 @@ 33 1257 287 - 32306 + 32293 525 processor/formatters_test.go @@ -48,7 +48,7 @@ 3 1304 120 - 34187 + 34174 385 processor/workers.go @@ -58,7 +58,7 @@ 91 654 226 - 25549 + 25536 495 processor/processor.go @@ -68,7 +68,7 @@ 103 424 92 - 19301 + 19295 435 main.go @@ -78,7 +78,7 @@ 6 382 10 - 8869 + 8856 253 processor/detector_test.go @@ -88,7 +88,7 @@ 2 304 101 - 7271 + 7258 149 cmd/badges/main.go @@ -108,7 +108,7 @@ 2 210 40 - 4040 + 4027 125 processor/detector.go @@ -118,7 +118,7 @@ 33 159 57 - 6245 + 6232 151 processor/file_test.go @@ -128,7 +128,7 @@ 1 162 37 - 4598 + 4585 97 processor/structs.go @@ -138,7 +138,7 @@ 18 160 17 - 5896 + 5883 139 processor/workers_regression_test.go @@ -148,7 +148,7 @@ 5 146 40 - 3415 + 3402 93 processor/file.go @@ -158,7 +158,7 @@ 16 127 50 - 3779 + 3766 99 processor/processor_test.go @@ -168,7 +168,7 @@ 1 114 21 - 2586 + 2573 66 cmd/badges/main_test.go @@ -198,7 +198,7 @@ 1 84 10 - 1995 + 1982 57 scripts/include.go @@ -218,18 +218,8 @@ 14 41 8 - 2043 + 2030 52 - - processor/filereader.go - - 52 - 10 - 10 - 32 - 6 - 1329 - 37 cmd/badges/simplecache_test.go @@ -240,6 +230,16 @@ 9 1041 30 + + processor/filereader.go + + 52 + 10 + 10 + 32 + 6 + 1316 + 37 processor/cocomo.go @@ -248,18 +248,8 @@ 18 19 0 - 2222 + 2209 35 - - processor/cocomo_test.go - - 37 - 8 - 4 - 25 - 6 - 699 - 23 processor/bloom.go @@ -270,6 +260,16 @@ 2 1062 29 + + processor/cocomo_test.go + + 37 + 8 + 4 + 25 + 6 + 686 + 23 processor/helpers_test.go @@ -278,7 +278,7 @@ 1 19 4 - 447 + 434 18 processor/processor_unix_test.go @@ -288,7 +288,7 @@ 3 15 0 - 424 + 411 16 examples/language/go.go @@ -308,7 +308,7 @@ 4 10 0 - 391 + 378 14 processor/constants.go @@ -324,15 +324,15 @@ Total 30 - 9518 + 9519 1461 456 - 7601 + 7602 1517 - 254263 + 253980 4051 - Estimated Cost to Develop (organic) $227,252
Estimated Schedule Effort (organic) 7.83 months
Estimated People Required (organic) 2.58
+ Estimated Cost to Develop (organic) $227,284
Estimated Schedule Effort (organic) 7.83 months
Estimated People Required (organic) 2.58
\ No newline at end of file diff --git a/processor/formatters.go b/processor/formatters.go index f7878e10a..32781cd50 100644 --- a/processor/formatters.go +++ b/processor/formatters.go @@ -1463,7 +1463,7 @@ func aggregateLanguageSummary(input chan *FileJob) []LanguageSummary { Count: 1, Files: files, Bytes: res.Bytes, - ULOC: len(ulocLanguageCount[res.Language]), + ULOC: 0, } } else { tmp := langs[res.Language] @@ -1482,13 +1482,14 @@ func aggregateLanguageSummary(input chan *FileJob) []LanguageSummary { Count: tmp.Count + 1, Files: files, Bytes: res.Bytes + tmp.Bytes, - ULOC: len(ulocLanguageCount[res.Language]), + ULOC: 0, } } } language := make([]LanguageSummary, 0, len(langs)) for _, summary := range langs { + summary.ULOC = len(ulocLanguageCount[summary.Name]) // for #498 language = append(language, summary) }