Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

checkers: add fixable for commentFormatting (#1190) #1191

Merged
merged 2 commits into from Jan 8, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion checkers/commentFormatting_checker.go
Expand Up @@ -111,5 +111,9 @@ func (c *commentFormattingChecker) specialChar(r rune) bool {
}

func (c *commentFormattingChecker) warn(comment *ast.Comment) {
c.ctx.Warn(comment, "put a space between `//` and comment text")
c.ctx.WarnFixable(comment, linter.QuickFix{
From: comment.Pos(),
To: comment.End(),
Replacement: []byte(strings.Replace(comment.Text, "//", "// ", 1)),
}, "put a space between `//` and comment text")
}