Documentation ¶
Overview ¶
Package lint2hub automates creating GitHub pull requests review comments in response to code linters.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrSHANotLatest is returned if the latest pull request SHA does not // match the provided SHA ErrSHANotLatest = errors.New("latest pull request SHA does not match provided SHA") )
Functions ¶
This section is empty.
Types ¶
type Commenter ¶
type Commenter struct {
// contains filtered or unexported fields
}
Commenter is a high level GitHub client capable of commenting on pull request diffs. It caches the diff at a particular SHA and also attempts to prevent duplicate line comments from being posted.
func NewCommenter ¶
func NewCommenter(ctx context.Context, gh *github.Client, owner string, repo string, prNumber int, sha string) (*Commenter, error)
NewCommenter creates a new commenting client. If the provided sha is not the latest SHA, ErrSHANotLatest is returned to avoid commenting on an outdated diff.
func (*Commenter) GetPosition ¶
GetPosition retrieves the diff position for a given file and lineNum. Returns (0, false) if the position is not present in the diff, meaning a comment cannot be posted on that lineNum within the pull request.