From 9049fb0c46c2f9d3b1bb12a1b118f84cf2d2dcd3 Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Tue, 1 Mar 2022 12:10:29 +0100 Subject: [PATCH] logcheck: harmonize report messages If the message consists of full sentences, it should use valid spelling (upper capital at the beginning, full stop at the end). Shorter messages should be consistent with messages from other tools where lower case seems to be more common (https://grep.app/search?q=pass.Report). --- hack/tools/logcheck/pkg/logcheck.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hack/tools/logcheck/pkg/logcheck.go b/hack/tools/logcheck/pkg/logcheck.go index eb9e172e..f4f8c741 100644 --- a/hack/tools/logcheck/pkg/logcheck.go +++ b/hack/tools/logcheck/pkg/logcheck.go @@ -331,14 +331,14 @@ func isKeysValid(keyValues []ast.Expr, fun ast.Expr, pass *analysis.Pass, funNam if !ok { pass.Report(analysis.Diagnostic{ Pos: fun.Pos(), - Message: fmt.Sprintf("Key positional arguments are expected to be inlined constant strings. Please replace %v provided with string value", arg), + Message: fmt.Sprintf("Key positional arguments are expected to be inlined constant strings. Please replace %v provided with string value.", arg), }) continue } if lit.Kind != token.STRING { pass.Report(analysis.Diagnostic{ Pos: fun.Pos(), - Message: fmt.Sprintf("Key positional arguments are expected to be inlined constant strings. Please replace %v provided with string value", lit.Value), + Message: fmt.Sprintf("Key positional arguments are expected to be inlined constant strings. Please replace %v provided with string value.", lit.Value), }) continue } @@ -483,7 +483,7 @@ func checkForIfEnabled(i *ast.IfStmt, pass *analysis.Pass, c *config) { pass.Report(analysis.Diagnostic{ Pos: i.Pos(), End: i.End(), - Message: fmt.Sprintf("The result of %s should be stored in a variable and then be used multiple times: if %s := %s(); %s.Enabled() { ... %s.Info ... }", + Message: fmt.Sprintf("the result of %s should be stored in a variable and then be used multiple times: if %s := %s(); %s.Enabled() { ... %s.Info ... }", funcCall, varName, funcCall, varName, varName), }) }