Skip to content

Commit

Permalink
add uloc to wide output
Browse files Browse the repository at this point in the history
  • Loading branch information
boyter committed May 1, 2024
1 parent 3e5ed99 commit 748355e
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions processor/formatters.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ var tabularWideFormatBody = "%-33s %9d %9d %8d %9d %8d %10d %16.2f\n"
var tabularWideFormatFile = "%s %9d %8d %9d %8d %10d %16.2f\n"
var wideFormatFileTruncate = 42

var tabularWideUlocLanguageFormatBody = "(ULOC) %46d\n"
var tabularWideUlocGlobalFormatBody = "Unique Lines of Code (ULOC) %25d\n"

var openMetricsMetadata = `# TYPE scc_files count
# HELP scc_files Number of sourcecode files.
# TYPE scc_lines count
Expand Down Expand Up @@ -892,6 +895,13 @@ func fileSummarizeLong(input chan *FileJob) string {

str.WriteString(fmt.Sprintf(tabularWideFormatBody, trimmedName, summary.Count, summary.Lines, summary.Blank, summary.Comment, summary.Code, summary.Complexity, summary.WeightedComplexity))

if UlocMode {
str.WriteString(fmt.Sprintf(tabularWideUlocLanguageFormatBody, len(ulocLanguageCount[summary.Name])))
if summary.Name != language[len(language)-1].Name {
str.WriteString(tabularWideBreakCi)
}
}

if Files {
sortSummaryFiles(&summary)
str.WriteString(getTabularWideBreak())
Expand All @@ -913,6 +923,15 @@ func fileSummarizeLong(input chan *FileJob) string {
str.WriteString(fmt.Sprintf(tabularWideFormatBody, "Total", sumFiles, sumLines, sumBlank, sumComment, sumCode, sumComplexity, sumWeightedComplexity))
str.WriteString(getTabularWideBreak())

if UlocMode {
str.WriteString(fmt.Sprintf(tabularWideUlocGlobalFormatBody, len(ulocGlobalCount)))
if Dryness {
dryness := float64(len(ulocGlobalCount)) / float64(sumLines)
str.WriteString(fmt.Sprintf("DRYness %% %43.2f\n", dryness))
}
str.WriteString(getTabularWideBreak())
}

if !Cocomo {
if SLOCCountFormat {
calculateCocomoSLOCCount(sumCode, &str)
Expand Down

0 comments on commit 748355e

Please sign in to comment.