add uloc html output · boyter/scc@6147a04

@@ -477,7 +477,7 @@ func toOpenMetricsFiles(input chan *FileJob) string {

477477

// with the express idea of lowering memory usage, see https://github.com/boyter/scc/issues/210 for

478478

// the background on why this might be needed

479479

func toCSVStream(input chan *FileJob) string {

480-

fmt.Println("Language,Provider,Filename,Lines,Code,Comments,Blanks,Complexity,Bytes")

480+

fmt.Println("Language,Provider,Filename,Lines,Code,Comments,Blanks,Complexity,Bytes,Uloc")

481481482482

var quoteRegex = regexp.MustCompile("\"")

483483

@@ -486,7 +486,7 @@ func toCSVStream(input chan *FileJob) string {

486486

var location = "\"" + quoteRegex.ReplaceAllString(result.Location, "\"\"") + "\""

487487

var filename = "\"" + quoteRegex.ReplaceAllString(result.Filename, "\"\"") + "\""

488488489-

fmt.Println(fmt.Sprintf("%s,%s,%s,%s,%s,%s,%s,%s,%s",

489+

fmt.Println(fmt.Sprintf("%s,%s,%s,%s,%s,%s,%s,%s,%s,%s",

490490

result.Language,

491491

location,

492492

filename,

@@ -496,6 +496,7 @@ func toCSVStream(input chan *FileJob) string {

496496

fmt.Sprint(result.Blank),

497497

fmt.Sprint(result.Complexity),

498498

fmt.Sprint(result.Bytes),

499+

fmt.Sprint(result.Uloc),

499500

))

500501

}

501502

@@ -575,6 +576,7 @@ func toHtmlTable(input chan *FileJob) string {

575576

<th>Code</th>

576577

<th>Complexity</th>

577578

<th>Bytes</th>

579+

<th>Uloc</th>

578580

</tr></thead>

579581

<tbody>`)

580582

@@ -588,7 +590,8 @@ func toHtmlTable(input chan *FileJob) string {

588590

<th>%d</th>

589591

<th>%d</th>

590592

<th>%d</th>

591-

</tr>`, r.Name, len(r.Files), r.Lines, r.Blank, r.Comment, r.Code, r.Complexity, r.Bytes))

593+

<th>%d</th>

594+

</tr>`, r.Name, len(r.Files), r.Lines, r.Blank, r.Comment, r.Code, r.Complexity, r.Bytes, len(ulocLanguageCount[r.Name])))

592595593596

if Files {

594597

sortSummaryFiles(&r)

@@ -603,7 +606,8 @@ func toHtmlTable(input chan *FileJob) string {

603606

<td>%d</td>

604607

<td>%d</td>

605608

<td>%d</td>

606-

</tr>`, res.Location, res.Lines, res.Blank, res.Comment, res.Code, res.Complexity, res.Bytes))

609+

<td>%d</td>

610+

</tr>`, res.Location, res.Lines, res.Blank, res.Comment, res.Code, res.Complexity, res.Bytes, res.Uloc))

607611

}

608612

}

609613

@@ -619,8 +623,9 @@ func toHtmlTable(input chan *FileJob) string {

619623

<th>%d</th>

620624

<th>%d</th>

621625

<th>%d</th>

626+

<th>%d</th>

622627

</tr></tfoot>

623-

</table>`, sumFiles, sumLines, sumBlank, sumComment, sumCode, sumComplexity, sumBytes))

628+

</table>`, sumFiles, sumLines, sumBlank, sumComment, sumCode, sumComplexity, sumBytes, len(ulocGlobalCount)))

624629625630

return str.String()

626631

}