From 2a06dcb3293e802297724921943c4b2944e68fb7 Mon Sep 17 00:00:00 2001 From: Ludovic Fernandez Date: Sun, 29 Dec 2024 13:39:44 +0100 Subject: [PATCH] dev: clarifies and homogenizes formatter descriptions (#5265) --- pkg/golinters/gci/internal/analyzer.go | 2 +- pkg/golinters/gofmt/gofmt.go | 3 +-- pkg/golinters/gofumpt/gofumpt.go | 2 +- pkg/golinters/goimports/goimports.go | 5 ++--- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/pkg/golinters/gci/internal/analyzer.go b/pkg/golinters/gci/internal/analyzer.go index 9e34ddfea017..92921e48560e 100644 --- a/pkg/golinters/gci/internal/analyzer.go +++ b/pkg/golinters/gci/internal/analyzer.go @@ -44,7 +44,7 @@ func NewAnalyzer() *analysis.Analyzer { a := &analysis.Analyzer{ Name: "gci", - Doc: "A tool that control Go package import order and make it always deterministic.", + Doc: "Checks if code and import statements are formatted, it makes import statements always deterministic.", Run: runAnalysis, Requires: []*analysis.Analyzer{inspect.Analyzer}, } diff --git a/pkg/golinters/gofmt/gofmt.go b/pkg/golinters/gofmt/gofmt.go index 57627fa07094..a7ccfa899096 100644 --- a/pkg/golinters/gofmt/gofmt.go +++ b/pkg/golinters/gofmt/gofmt.go @@ -23,8 +23,7 @@ func New(settings *config.GoFmtSettings) *goanalysis.Linter { return goanalysis.NewLinter( linterName, - "Gofmt checks whether code was gofmt-ed. By default "+ - "this tool runs with -s option to check for code simplification", + "Checks if the code is formatted according to 'gofmt' command.", []*analysis.Analyzer{analyzer}, nil, ).WithContextSetter(func(lintCtx *linter.Context) { diff --git a/pkg/golinters/gofumpt/gofumpt.go b/pkg/golinters/gofumpt/gofumpt.go index a941a35f7e17..b27f20a250ed 100644 --- a/pkg/golinters/gofumpt/gofumpt.go +++ b/pkg/golinters/gofumpt/gofumpt.go @@ -44,7 +44,7 @@ func New(settings *config.GofumptSettings) *goanalysis.Linter { return goanalysis.NewLinter( linterName, - "Gofumpt checks whether code was gofumpt-ed.", + "Checks if code and import statements are formatted, with additional rules.", []*analysis.Analyzer{analyzer}, nil, ).WithContextSetter(func(lintCtx *linter.Context) { diff --git a/pkg/golinters/goimports/goimports.go b/pkg/golinters/goimports/goimports.go index add4182c0be8..2f08dcde060a 100644 --- a/pkg/golinters/goimports/goimports.go +++ b/pkg/golinters/goimports/goimports.go @@ -24,8 +24,7 @@ func New(settings *config.GoImportsSettings) *goanalysis.Linter { return goanalysis.NewLinter( linterName, - "Check import statements are formatted according to the 'goimport' command. "+ - "Reformat imports in autofix mode.", + "Checks if the code and import statements are formatted according to the 'goimports' command.", []*analysis.Analyzer{analyzer}, nil, ).WithContextSetter(func(lintCtx *linter.Context) { @@ -56,7 +55,7 @@ func runGoImports(lintCtx *linter.Context, pass *analysis.Pass) error { err = internal.ExtractDiagnosticFromPatch(pass, file, string(diff), lintCtx) if err != nil { - return fmt.Errorf("can't extract issues from gofmt diff output %q: %w", string(diff), err) + return fmt.Errorf("can't extract issues from goimports diff output %q: %w", string(diff), err) } }