diff --git a/processor/formatters.go b/processor/formatters.go index e87ad0d9e..3d74532a6 100644 --- a/processor/formatters.go +++ b/processor/formatters.go @@ -477,7 +477,7 @@ func toOpenMetricsFiles(input chan *FileJob) string { // with the express idea of lowering memory usage, see https://github.com/boyter/scc/issues/210 for // the background on why this might be needed func toCSVStream(input chan *FileJob) string { - fmt.Println("Language,Provider,Filename,Lines,Code,Comments,Blanks,Complexity,Bytes") + fmt.Println("Language,Provider,Filename,Lines,Code,Comments,Blanks,Complexity,Bytes,Uloc") var quoteRegex = regexp.MustCompile("\"") @@ -486,7 +486,7 @@ func toCSVStream(input chan *FileJob) string { var location = "\"" + quoteRegex.ReplaceAllString(result.Location, "\"\"") + "\"" var filename = "\"" + quoteRegex.ReplaceAllString(result.Filename, "\"\"") + "\"" - fmt.Println(fmt.Sprintf("%s,%s,%s,%s,%s,%s,%s,%s,%s", + fmt.Println(fmt.Sprintf("%s,%s,%s,%s,%s,%s,%s,%s,%s,%s", result.Language, location, filename, @@ -496,6 +496,7 @@ func toCSVStream(input chan *FileJob) string { fmt.Sprint(result.Blank), fmt.Sprint(result.Complexity), fmt.Sprint(result.Bytes), + fmt.Sprint(result.Uloc), )) } @@ -575,6 +576,7 @@ func toHtmlTable(input chan *FileJob) string { Code Complexity Bytes + Uloc `) @@ -588,7 +590,8 @@ func toHtmlTable(input chan *FileJob) string { %d %d %d - `, r.Name, len(r.Files), r.Lines, r.Blank, r.Comment, r.Code, r.Complexity, r.Bytes)) + %d + `, r.Name, len(r.Files), r.Lines, r.Blank, r.Comment, r.Code, r.Complexity, r.Bytes, len(ulocLanguageCount[r.Name]))) if Files { sortSummaryFiles(&r) @@ -603,7 +606,8 @@ func toHtmlTable(input chan *FileJob) string { %d %d %d - `, res.Location, res.Lines, res.Blank, res.Comment, res.Code, res.Complexity, res.Bytes)) + %d + `, res.Location, res.Lines, res.Blank, res.Comment, res.Code, res.Complexity, res.Bytes, res.Uloc)) } } @@ -619,8 +623,9 @@ func toHtmlTable(input chan *FileJob) string { %d %d %d + %d - `, sumFiles, sumLines, sumBlank, sumComment, sumCode, sumComplexity, sumBytes)) + `, sumFiles, sumLines, sumBlank, sumComment, sumCode, sumComplexity, sumBytes, len(ulocGlobalCount))) return str.String() } diff --git a/processor/structs.go b/processor/structs.go index 48ff27f7c..47e89a561 100644 --- a/processor/structs.go +++ b/processor/structs.go @@ -78,7 +78,7 @@ type FileJob struct { Complexity int64 WeightedComplexity float64 Hash hash.Hash - Callback FileJobCallback + Callback FileJobCallback `json:"-"` Binary bool Minified bool Generated bool