service/commentutil: support code (diagnostic rule)
@@ -65,6 +65,13 @@ func MarkdownComment(c *reviewdog.Comment) string {
if tool := toolName(c); tool != "" {
sb.WriteString(fmt.Sprintf("**[%s]** ", tool))
}
+ if code := c.Result.Diagnostic.GetCode().GetValue(); code != "" {
+ if url := c.Result.Diagnostic.GetCode().GetUrl(); url != "" {
+ sb.WriteString(fmt.Sprintf("<[%s](%s)> ", code, url))
+ } else {
+ sb.WriteString(fmt.Sprintf("<%s> ", code))
+ }
+ }
sb.WriteString(BodyPrefix)
sb.WriteString(c.Result.Diagnostic.GetMessage())
return sb.String()
