Repository: prometheus/prometheus
File: cmd/promtool/main.go (Go)

Code before:
	//nolint:staticcheck
	model.NameValidationScheme = model.UTF8Validation
}

const (
	successExitCode = 0
	failureExitCode = 1
	// Exit code 3 is used for "one or more lint issues detected".
	lintErrExitCode = 3

	lintOptionAll                   = "all"
	lintOptionDuplicateRules        = "duplicate-rules"
	lintOptionTooLongScrapeInterval = "too-long-scrape-interval"
	lintOptionNone                  = "none"
	checkHealth                     = "/-/healthy"
	checkReadiness                  = "/-/ready"
)

var (
	lintRulesOptions = []string{lintOptionAll, lintOptionDuplicateRules, lintOptionNone}
	// Same as lintRulesOptions, but including scrape config linting options as well.
	lintConfigOptions = append(append([]string{}, lintRulesOptions...), lintOptionTooLongScrapeInterval)
)

const httpConfigFileDescription = "HTTP client configuration file for promtool to connect to Prometheus." + " " +
	"For more information, please visit the following page: https://prometheus.io/docs/prometheus/latest/configuration/promtool"

func main() {
	var (
		httpRoundTripper   = api.DefaultRoundTripper
		serverURL          *url.URL
		remoteWriteURL     *url.URL
		httpConfigFilePath string
	)

	ctx := context.Background()

	app := kingpin.New(filepath.Base(os.Args[0]), "Tooling for the Prometheus monitoring system.").UsageWriter(os.Stdout)
	app.Version(version.Print("promtool"))
	app.HelpFlag.Short('h')

	checkCmd := app.Command("check", "Check the resources for validity.")
	checkLookbackDelta := checkCmd.Flag(
		"query.lookback-delta",
		"The server's maximum query lookback duration.",
	).Default("5m").Duration()

	experimental := app.Flag("experimental", "Enable experimental commands.").Bool()

	sdCheckCmd := checkCmd.Command("service-discovery", "Perform service discovery for the given job name and report the results, including relabeling.")
	sdConfigFile := sdCheckCmd.Arg("config-file", "The prometheus config file.").Required().ExistingFile()

Review comment (suggestion):
I think this is the right approach in general, but let's be a bit more compact here. (We don't need to mention that this is for promtool, and neither that we are talking to Prometheus, and we don't have to say "please" here, this is supposed to be short command line help.) And no need for additional line breaks here. How about this:
```suggestion
const httpConfigFileDescription = "HTTP client configuration file, see details at https://prometheus.io/docs/prometheus/latest/configuration/promtool"
```

Code after:
	//nolint:staticcheck
	model.NameValidationScheme = model.UTF8Validation
}

const (
	successExitCode = 0
	failureExitCode = 1
	// Exit code 3 is used for "one or more lint issues detected".
	lintErrExitCode = 3

	lintOptionAll                   = "all"
	lintOptionDuplicateRules        = "duplicate-rules"
	lintOptionTooLongScrapeInterval = "too-long-scrape-interval"
	lintOptionNone                  = "none"
	checkHealth                     = "/-/healthy"
	checkReadiness                  = "/-/ready"
)

var (
	lintRulesOptions = []string{lintOptionAll, lintOptionDuplicateRules, lintOptionNone}
	// Same as lintRulesOptions, but including scrape config linting options as well.
	lintConfigOptions = append(append([]string{}, lintRulesOptions...), lintOptionTooLongScrapeInterval)
)

const httpConfigFileDescription = "HTTP client configuration file, see details at https://prometheus.io/docs/prometheus/latest/configuration/promtool"

func main() {
	var (
		httpRoundTripper   = api.DefaultRoundTripper
		serverURL          *url.URL
		remoteWriteURL     *url.URL
		httpConfigFilePath string
	)

	ctx := context.Background()

	app := kingpin.New(filepath.Base(os.Args[0]), "Tooling for the Prometheus monitoring system.").UsageWriter(os.Stdout)
	app.Version(version.Print("promtool"))
	app.HelpFlag.Short('h')

	checkCmd := app.Command("check", "Check the resources for validity.")
	checkLookbackDelta := checkCmd.Flag(
		"query.lookback-delta",
		"The server's maximum query lookback duration.",
	).Default("5m").Duration()

	experimental := app.Flag("experimental", "Enable experimental commands.").Bool()

	sdCheckCmd := checkCmd.Command("service-discovery", "Perform service discovery for the given job name and report the results, including relabeling.")
	sdConfigFile := sdCheckCmd.Arg("config-file", "The prometheus config file.").Required().ExistingFile()
	sdJobName := sdCheckCmd.Arg("job", "The job to run service discovery for.").Required().String()