Skip to content

Commit

Permalink
checkers: add fixable for commentFormatting (#1190) (#1191)
Browse files Browse the repository at this point in the history
Fixes #1190
  • Loading branch information
okhowang committed Jan 8, 2022
1 parent eb73c6d commit f0a10a0
Showing 1 changed file with 5 additions and 1 deletion.
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")
}

0 comments on commit f0a10a0

Please sign in to comment.