Skip to content

Commit

Permalink
feat: Improve markdown/html output (#1795)
Browse files Browse the repository at this point in the history
* feat: Improve markdown output

Resolves #1791

Signed-off-by: Liam Galvin <[email protected]>

* feat: Improve html output
  • Loading branch information
liamg authored Jun 15, 2022
1 parent 9f50a32 commit 7b7e5c3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions internal/pkg/formatter/html.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func printResultsTableHTML(b formatters.ConfigurableFormatter, title string, res
return scoreI > scoreJ
})

_, _ = fmt.Fprintf(b.Writer(), " <h2>%d %s</h2>\n", len(results), title)
_, _ = fmt.Fprintf(b.Writer(), " <h2>%s: %d issue(s)</h2>\n", title, len(results))
_, _ = fmt.Fprintf(b.Writer(), ` <table class="pure-table">
<thead>
<tr><th> # </th><th> ID </th><th> Severity </th><th> Title </th><th> Location </th><th> Description </th></tr>
Expand Down Expand Up @@ -112,7 +112,7 @@ func printResultsTableHTML(b formatters.ConfigurableFormatter, title string, res
<td>%s</td>
</tr>
`,
i,
i+1,
href,
result.Rule().LongID(),
result.Severity(),
Expand Down
4 changes: 2 additions & 2 deletions internal/pkg/formatter/markdown.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func printResultsTableMarkdown(b formatters.ConfigurableFormatter, title string,
if len(results) == 0 {
return
}
_, _ = fmt.Fprintf(b.Writer(), "## %d %s\n", len(results), title)
_, _ = fmt.Fprintf(b.Writer(), "## %s: %d issue(s)\n", title, len(results))
_, _ = fmt.Fprintf(b.Writer(), "| # | ID | Severity | Title | Location | Description |\n")
_, _ = fmt.Fprintf(b.Writer(), "|---|----|----------|-------|----------|-------------|\n")
for i, result := range results {
Expand All @@ -47,7 +47,7 @@ func printResultsTableMarkdown(b formatters.ConfigurableFormatter, title string,
_, _ = fmt.Fprintf(
b.Writer(),
"| %d | `%s` | *%s* | _%s_ | `%s` | %s |\n",
i,
i+1,
result.Rule().LongID(),
result.Severity(),
result.Rule().Summary,
Expand Down

0 comments on commit 7b7e5c3

Please sign in to comment.