commentutil

package
v0.0.0-...-bc1001e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 2, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const BodyPrefix = `<sub>reported by [reviewdog](https://github.com/reviewdog/reviewdog) :dog:</sub><br>`

BodyPrefix is prefix text of comment body.

Variables

This section is empty.

Functions

func GetCodeFenceLength

func GetCodeFenceLength(code string) int

GetCodeFenceLength returns the length of a code fence needed to wrap code. A test suggestion that uses four backticks w/o code fence block. Fixes: https://github.com/reviewdog/reviewdog/issues/999

Code fenced blocks are supported by GitHub Flavor Markdown. A code fence is typically three backticks.

```
code
```

However, we sometimes need more backticks. https://docs.github.com/en/github/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks#fenced-code-blocks

> To display triple backticks in a fenced code block, wrap them inside quadruple backticks. > > ```` > ``` > Look! You can see my backticks. > ``` > ````

func MarkdownComment

func MarkdownComment(c *reviewdog.Comment) string

MarkdownComment creates comment body markdown.

func WriteCodeFence

func WriteCodeFence(w io.Writer, length int) error

WriteCodeFence writes a code fence to w.

Types

type PostedComments

type PostedComments map[string]map[int][]string

`path` to `position`(Lnum for new file) to comment `body`s

func (PostedComments) AddPostedComment

func (p PostedComments) AddPostedComment(path string, lineNum int, body string)

AddPostedComment adds a posted comment.

func (PostedComments) DebugLog

func (p PostedComments) DebugLog()

DebugLog outputs posted comments as log for debugging.

func (PostedComments) IsPosted

func (p PostedComments) IsPosted(c *reviewdog.Comment, lineNum int, body string) bool

IsPosted returns true if a given comment has been posted in code review service already, otherwise returns false. It sees comments with same path, same position, and same body as same comments.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL