Skip to content

Commit

Permalink
dev: improve formatting and description in flagsets (#4636)
Browse files Browse the repository at this point in the history
Co-authored-by: Fernandez Ludovic <[email protected]>
  • Loading branch information
aimuz and ldez committed Apr 11, 2024
1 parent 46e7153 commit 5cefda5
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions pkg/commands/flagsets.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@ func setupLintersFlagSet(v *viper.Viper, fs *pflag.FlagSet) {
color.GreenString("Enable only fast linters from enabled linters set (first run won't be fast)"))

internal.AddHackedStringSliceP(fs, "presets", "p",
color.GreenString(fmt.Sprintf("Enable presets (%s) of linters. Run 'golangci-lint help linters' to see them. "+
"This option implies option --disable-all", strings.Join(lintersdb.AllPresets(), "|"))))
color.GreenString(fmt.Sprintf("Enable presets (%s) of linters.\n"+
"Run 'golangci-lint help linters' to see them.\n"+
"This option implies option --disable-all",
strings.Join(lintersdb.AllPresets(), "|"),
)))

fs.StringSlice("enable-only", nil,
color.GreenString("Override linters configuration section to only run the specific linter(s)")) // Flags only.
Expand All @@ -53,11 +56,11 @@ func setupRunFlagSet(v *viper.Viper, fs *pflag.FlagSet) {
internal.AddDeprecatedFlagAndBind(v, fs, fs.Bool, "skip-dirs-use-default", "run.skip-dirs-use-default", true,
getDefaultDirectoryExcludeHelp())

const allowParallelDesc = "Allow multiple parallel golangci-lint instances running. " +
const allowParallelDesc = "Allow multiple parallel golangci-lint instances running.\n" +
"If false (default) - golangci-lint acquires file lock on start."
internal.AddFlagAndBind(v, fs, fs.Bool, "allow-parallel-runners", "run.allow-parallel-runners", false,
color.GreenString(allowParallelDesc))
const allowSerialDesc = "Allow multiple golangci-lint instances running, but serialize them around a lock. " +
const allowSerialDesc = "Allow multiple golangci-lint instances running, but serialize them around a lock.\n" +
"If false (default) - golangci-lint exits with an error if it fails to acquire file lock on start."
internal.AddFlagAndBind(v, fs, fs.Bool, "allow-serial-runners", "run.allow-serial-runners", false, color.GreenString(allowSerialDesc))
}
Expand Down

0 comments on commit 5cefda5

Please sign in to comment.