Skip to content

Commit 6c7a3df

Browse files
Use title-case headers and add pretty output format
- Change table headers from ALL CAPS to Title Case across all commands - Normalize status labels to Title Case in analysis output - Rename default output format from "table" to "pretty", keeping "table" as alias - Add "pretty" to shell completion candidates
1 parent c3e6e01 commit 6c7a3df

7 files changed

Lines changed: 19 additions & 16 deletions

File tree

command/analysis/analysis.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ func (opts *AnalysisOptions) outputRunDetailJSON(runWithIssues *runs.RunWithIssu
291291
// --- Display helpers ---
292292

293293
func showRunsTable(analysisRuns []runs.AnalysisRun) {
294-
header := []string{"COMMIT", "BRANCH", "STATUS", "INTRODUCED", "RESOLVED", "SUPPRESSED", "FINISHED"}
294+
header := []string{"Commit", "Branch", "Status", "Introduced", "Resolved", "Suppressed", "Finished"}
295295
data := [][]string{header}
296296

297297
for _, run := range analysisRuns {
@@ -369,13 +369,13 @@ func showIssuesSummary(issues []runs.RunIssue) {
369369
func formatStatus(status string) string {
370370
switch strings.ToUpper(status) {
371371
case "SUCCESS":
372-
return pterm.Green(status)
372+
return pterm.Green("Success")
373373
case "FAILURE":
374-
return pterm.Red(status)
374+
return pterm.Red("Failure")
375375
case "PENDING":
376-
return pterm.Yellow(status)
376+
return pterm.Yellow("Pending")
377377
case "RUNNING":
378-
return pterm.Cyan(status)
378+
return pterm.Cyan("Running")
379379
default:
380380
return status
381381
}

command/issues/issues.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,9 +389,9 @@ func (opts *IssuesOptions) outputTable() error {
389389

390390
var header []string
391391
if showSource {
392-
header = []string{"LOCATION", "SOURCE", "ANALYZER", "CODE", "TITLE", "CATEGORY", "SEVERITY"}
392+
header = []string{"Location", "Source", "Analyzer", "Code", "Title", "Category", "Severity"}
393393
} else {
394-
header = []string{"LOCATION", "ANALYZER", "CODE", "TITLE", "CATEGORY", "SEVERITY"}
394+
header = []string{"Location", "Analyzer", "Code", "Title", "Category", "Severity"}
395395
}
396396
data := [][]string{header}
397397

command/metrics/metrics.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ func (opts *MetricsOptions) outputTable() error {
248248
}
249249

250250
// Build metrics table
251-
header := []string{"METRIC", "KEY", "VALUE", "THRESHOLD", "STATUS"}
251+
header := []string{"Metric", "Key", "Value", "Threshold", "Status"}
252252
data := [][]string{header}
253253

254254
for _, m := range metricsList {
@@ -297,7 +297,7 @@ func (opts *MetricsOptions) outputChangesetStats() {
297297

298298
pterm.DefaultSection.Println("Changeset Coverage")
299299

300-
header := []string{"TYPE", "OVERALL", "COVERED", "NEW", "NEW COVERED"}
300+
header := []string{"Type", "Overall", "Covered", "New", "New Covered"}
301301
data := [][]string{header}
302302

303303
// Lines

command/report/report.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,14 @@ func NewCmdReportWithDeps(deps *container.Container) *cobra.Command {
9696
cmd.Flags().StringVar(&opts.OIDCRequestUrl, "oidc-request-url", "", "OIDC provider's request URL to fetch an OIDC token")
9797
cmd.Flags().StringVar(&opts.DeepSourceHostEndpoint, "deepsource-host-endpoint", "https://app.deepsource.com", "DeepSource host endpoint where the app is running. Defaults to the cloud endpoint https://app.deepsource.com")
9898
cmd.Flags().StringVar(&opts.OIDCProvider, "oidc-provider", "", "OIDC provider to use for authentication. Supported providers: github-actions")
99-
cmd.Flags().StringVar(&opts.Output, "output", "table", "Output format: table, json, yaml")
99+
cmd.Flags().StringVar(&opts.Output, "output", "pretty", "Output format: pretty, table, json, yaml")
100100

101101
// --skip-verify flag to skip SSL certificate verification while reporting test coverage data.
102102
cmd.Flags().BoolVar(&opts.SkipCertificateVerification, "skip-verify", false, "skip SSL certificate verification while sending the test coverage data")
103103

104104
_ = cmd.RegisterFlagCompletionFunc("output", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
105105
return []string{
106+
"pretty\tPretty-printed output",
106107
"table\tHuman-readable table",
107108
"json\tJSON output",
108109
"yaml\tYAML output",
@@ -168,7 +169,7 @@ func printReportResult(output interfaces.OutputWriter, format string, result *re
168169
}
169170

170171
switch format {
171-
case "", "table":
172+
case "", "pretty", "table":
172173
write("DeepSource | Artifact published successfully\n\n")
173174
write("Analyzer %s\n", result.Analyzer)
174175
write("Key %s\n", result.Key)

command/repository/analyzers/analyzers.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,13 @@ func NewCmdAnalyzersWithDeps(deps *cmddeps.Deps) *cobra.Command {
6262
}
6363

6464
cmd.Flags().StringVarP(&opts.RepoArg, "repo", "r", "", "List analyzers for a specific repository")
65-
cmd.Flags().StringVar(&opts.Output, "output", "table", "Output format: table, json, yaml")
65+
cmd.Flags().StringVar(&opts.Output, "output", "pretty", "Output format: pretty, table, json, yaml")
6666
_ = cmd.RegisterFlagCompletionFunc("repo", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
6767
return completion.RepoCompletionCandidates(), cobra.ShellCompDirectiveNoFileComp
6868
})
6969
_ = cmd.RegisterFlagCompletionFunc("output", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
7070
return []string{
71+
"pretty\tPretty-printed output",
7172
"table\tHuman-readable table",
7273
"json\tJSON output",
7374
"yaml\tYAML output",
@@ -102,7 +103,7 @@ func (opts *AnalyzersOptions) Run() error {
102103
func (opts *AnalyzersOptions) printAnalyzers(list []analyzers.Analyzer) error {
103104
w := opts.stdout()
104105
switch opts.Output {
105-
case "", "table":
106+
case "", "pretty", "table":
106107
if len(list) == 0 {
107108
pterm.Println("No analyzers enabled on this repository.")
108109
return nil

command/repository/status/status.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,13 @@ func NewCmdRepoStatusWithDeps(deps *cmddeps.Deps) *cobra.Command {
6767
}
6868

6969
cmd.Flags().StringVarP(&opts.RepoArg, "repo", "r", "", "Get the activation status of the specified repository")
70-
cmd.Flags().StringVar(&opts.Output, "output", "table", "Output format: table, json, yaml")
70+
cmd.Flags().StringVar(&opts.Output, "output", "pretty", "Output format: pretty, table, json, yaml")
7171
_ = cmd.RegisterFlagCompletionFunc("repo", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
7272
return completion.RepoCompletionCandidates(), cobra.ShellCompDirectiveNoFileComp
7373
})
7474
_ = cmd.RegisterFlagCompletionFunc("output", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
7575
return []string{
76+
"pretty\tPretty-printed output",
7677
"table\tHuman-readable table",
7778
"json\tJSON output",
7879
"yaml\tYAML output",
@@ -107,7 +108,7 @@ func (opts *RepoStatusOptions) Run() (err error) {
107108
func (opts *RepoStatusOptions) printStatus(result *reposvc.StatusResult) error {
108109
w := opts.stdout()
109110
switch opts.Output {
110-
case "", "table":
111+
case "", "pretty", "table":
111112
if result.Activated {
112113
pterm.Println("Analysis active on DeepSource (deepsource.com)")
113114
} else {

command/vulnerabilities/vulnerabilities.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ func (opts *VulnerabilitiesOptions) outputTable() error {
365365
}
366366

367367
// Build vulnerabilities table
368-
header := []string{"ID", "SEVERITY", "PACKAGE", "VERSION", "ECOSYSTEM", "FIX", "REACHABILITY"}
368+
header := []string{"ID", "Severity", "Package", "Version", "Ecosystem", "Fix", "Reachability"}
369369
data := [][]string{header}
370370

371371
for _, v := range vulnsList {

0 commit comments

Comments
 (0)