review

package
v0.0.0-...-1c93661 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2016 License: GPL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Open      = "Open"
	Submitted = "Submitted"
	Discarded = "Discarded"
)

Variables

View Source
var (
	ErrNotFound = errors.New("review does not exist")
)

Functions

This section is empty.

Types

type Annotation

type Annotation struct {
	File      int    `json:"file"`
	Hunk      int    `json:"hunk"`
	Line      int    `json:"line"`
	Comment   string `json:"comment"`
	User      string `json:"user"`
	Published bool   `json:"published"`
}

Annotation is a message about a particular line in a hunk. It is made by particular user who may or may not have published it. If an annotation is published, other reviewers will be able to view it.

type R

type R struct {
	Summary
	Revisions []Revision `json:"revisions"`
}

R is a code review. It is composed of a Summary and zero or more Revisions.

type Revision

type Revision struct {
	Files       []diff.File  `json:"files"`
	Annotations []Annotation `json:"annotations"`
}

A revision is a set of diff.Files with corresponding annotations. Annotations are a list of comments on a given line of the diff, identified by file, hunk and line-number indices.

func (*Revision) Annotate

func (r *Revision) Annotate(a Annotation)

Annotate annotates a file at a particular hunk and line number.

func (Revision) GetAnnotations

func (r Revision) GetAnnotations(file, hunk, line int, currentUser string) []Annotation

GetAnnotations gets the published annotations at the index provided. If none exists, it returns a nil slice.

func (Revision) UnpublishedAnnotationsFor

func (r Revision) UnpublishedAnnotationsFor(user string) (count int)

UnpublishedAnnotationsFor counts the number of un-published annotations made by user.

type Summary

type Summary struct {
	ID          int       `json:"id"`
	CommitMsg   string    `json:"commitMsg"`
	Submitter   string    `json:"submitter"`
	SubmittedAt time.Time `json:"submittedAt"`
	UpdatedAt   time.Time `json:"updatedAt"`
	Repository  string    `json:"repository"`
	Status      string    `json:"status"`
}

A Summary contains cursory facts about a Review.

type User

type User struct {
	sec.Credentials
}

User holds the information about an erickson user's account.

func NewUser

func NewUser(username, password string) (u User, err error)

NewUser creates a new user.

Jump to

Keyboard shortcuts

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