Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ require (
github.com/firefart/nonamedreturns v1.0.8
github.com/fzipp/gocyclo v0.6.0
github.com/ghostiam/protogetter v1.0.0
github.com/go-critic/go-critic v0.14.4
github.com/go-critic/go-critic v0.15.0
github.com/go-viper/mapstructure/v2 v2.5.0
github.com/go-xmlfmt/xmlfmt v1.1.3
github.com/godoc-lint/godoc-lint v0.11.4
Expand Down
4 changes: 2 additions & 2 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/golinters/internal/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func FormatCode(code string) string {
return code // TODO: properly escape or remove
}

return fmt.Sprintf("`%s`", code)
return fmt.Sprintf("%#q", code)
}

func GetGoFileNames(pass *analysis.Pass) []string {
Expand Down
2 changes: 1 addition & 1 deletion pkg/golinters/misspell/misspell.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func runMisspellOnFile(pass *analysis.Pass, file *ast.File, replacer *misspell.R
_, diffs := replace(string(fileContent))

for _, diff := range diffs {
text := fmt.Sprintf("`%s` is a misspelling of `%s`", diff.Original, diff.Corrected)
text := fmt.Sprintf("%#q is a misspelling of %#q", diff.Original, diff.Corrected)

start := f.LineStart(diff.Line) + token.Pos(diff.Column)
end := f.LineStart(diff.Line) + token.Pos(diff.Column+len(diff.Original))
Expand Down
12 changes: 6 additions & 6 deletions pkg/golinters/nolintlint/internal/issues.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,33 @@ import (
)

func formatExtraLeadingSpace(fullDirective string) string {
return fmt.Sprintf("directive `%s` should not have more than one leading space", fullDirective)
return fmt.Sprintf("directive %#q should not have more than one leading space", fullDirective)
}

func formatNotMachine(fullDirective string) string {
expected := fullDirective[:2] + strings.TrimLeftFunc(fullDirective[2:], unicode.IsSpace)
return fmt.Sprintf("directive `%s` should be written without leading space as `%s`",
return fmt.Sprintf("directive %#q should be written without leading space as %#q",
fullDirective, expected)
}

func formatNotSpecific(fullDirective, directiveWithOptionalLeadingSpace string) string {
return fmt.Sprintf("directive `%s` should mention specific linter such as `%s:my-linter`",
return fmt.Sprintf("directive %#q should mention specific linter such as `%s:my-linter`",
fullDirective, directiveWithOptionalLeadingSpace)
}

func formatParseError(fullDirective, directiveWithOptionalLeadingSpace string) string {
return fmt.Sprintf("directive `%s` should match `%s[:<comma-separated-linters>] [// <explanation>]`",
return fmt.Sprintf("directive %#q should match `%s[:<comma-separated-linters>] [// <explanation>]`",
fullDirective,
directiveWithOptionalLeadingSpace)
}

func formatNoExplanation(fullDirective, fullDirectiveWithoutExplanation string) string {
return fmt.Sprintf("directive `%s` should provide explanation such as `%s // this is why`",
return fmt.Sprintf("directive %#q should provide explanation such as `%s // this is why`",
fullDirective, fullDirectiveWithoutExplanation)
}

func formatUnusedCandidate(fullDirective, expectedLinter string) string {
details := fmt.Sprintf("directive `%s` is unused", fullDirective)
details := fmt.Sprintf("directive %#q is unused", fullDirective)
if expectedLinter != "" {
details += fmt.Sprintf(" for linter %q", expectedLinter)
}
Expand Down
Loading