Skip to content

Commit 053b81f

Browse files
committed
review
1 parent b90da31 commit 053b81f

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

pkg/commands/formatters.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ func (c *formattersCommand) execute(_ *cobra.Command, _ []string) error {
8484
return fmt.Errorf("can't get enabled formatters: %w", err)
8585
}
8686

87-
var enabledLinters []*linter.Config
88-
var disabledLCs []*linter.Config
87+
var enabledFormatters []*linter.Config
88+
var disabledFormatters []*linter.Config
8989

9090
for _, lc := range c.dbManager.GetAllSupportedLinterConfigs() {
9191
if lc.Internal {
@@ -97,16 +97,16 @@ func (c *formattersCommand) execute(_ *cobra.Command, _ []string) error {
9797
}
9898

9999
if enabledLintersMap[lc.Name()] == nil {
100-
disabledLCs = append(disabledLCs, lc)
100+
disabledFormatters = append(disabledFormatters, lc)
101101
} else {
102-
enabledLinters = append(enabledLinters, lc)
102+
enabledFormatters = append(enabledFormatters, lc)
103103
}
104104
}
105105

106106
color.Green("Enabled by your configuration formatters:\n")
107-
printFormatters(enabledLinters)
107+
printFormatters(enabledFormatters)
108108
color.Red("\nDisabled by your configuration formatters:\n")
109-
printFormatters(disabledLCs)
109+
printFormatters(disabledFormatters)
110110

111111
return nil
112112
}

pkg/commands/help.go

+9-4
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ func newHelpCommand(logger logutils.Log) *helpCommand {
4747
PreRunE: c.lintersPreRunE,
4848
}
4949

50+
fsLinter := lintersCmd.Flags()
51+
fsLinter.SortFlags = false // sort them as they are defined here
52+
53+
fsLinter.BoolVar(&c.opts.JSON, "json", false, color.GreenString("Display as JSON"))
54+
5055
helpCmd.AddCommand(lintersCmd)
5156

5257
formattersCmd := &cobra.Command{
@@ -58,12 +63,12 @@ func newHelpCommand(logger logutils.Log) *helpCommand {
5863
PreRunE: c.formattersPreRunE,
5964
}
6065

61-
helpCmd.AddCommand(formattersCmd)
66+
fsFormatter := formattersCmd.Flags()
67+
fsFormatter.SortFlags = false // sort them as they are defined here
6268

63-
fs := lintersCmd.Flags()
64-
fs.SortFlags = false // sort them as they are defined here
69+
fsFormatter.BoolVar(&c.opts.JSON, "json", false, color.GreenString("Display as JSON"))
6570

66-
fs.BoolVar(&c.opts.JSON, "json", false, color.GreenString("Display as JSON"))
71+
helpCmd.AddCommand(formattersCmd)
6772

6873
c.cmd = helpCmd
6974

0 commit comments

Comments
 (0)