Documentation ¶
Overview ¶
Package review contains the data structures used to represent code reviews.
Index ¶
- type CommentThread
- type Review
- func (r *Review) AddComment(c comment.Comment) error
- func (r *Review) GetAnalysesMessage() string
- func (r *Review) GetAnalysesNotes() ([]analyses.Note, error)
- func (r *Review) GetBaseCommit() (string, error)
- func (r *Review) GetBuildStatusMessage() string
- func (r *Review) GetDiff(diffArgs ...string) (string, error)
- func (r *Review) GetHeadCommit() (string, error)
- func (r *Review) GetJSON() (string, error)
- func (r *Review) ListCommits() ([]string, error)
- func (r *Review) Rebase(archivePrevious bool) error
- func (r *Review) RebaseAndSign(archivePrevious bool) error
- type Summary
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CommentThread ¶
type CommentThread struct { Hash string `json:"hash,omitempty"` Comment comment.Comment `json:"comment"` Original *comment.Comment `json:"original,omitempty"` Edits []*comment.Comment `json:"edits,omitempty"` Children []CommentThread `json:"children,omitempty"` Resolved *bool `json:"resolved,omitempty"` Edited bool `json:"edited,omitempty"` }
CommentThread represents the tree-based hierarchy of comments.
The Resolved field represents the aggregate status of the entire thread. If it is set to false, then it indicates that there is an unaddressed comment in the thread. If it is unset, then that means that the root comment is an FYI only, and that there are no unaddressed comments. If it is set to true, then that means that there are no unaddressed comments, and that the root comment has its resolved bit set to true.
func (*CommentThread) Verify ¶
func (thread *CommentThread) Verify() error
Verify verifies the signature on a comment.
type Review ¶
type Review struct { *Summary Reports []ci.Report `json:"reports,omitempty"` Analyses []analyses.Report `json:"analyses,omitempty"` }
Review represents the entire state of a code review.
This extends Summary to also include a list of reports for both the continuous integration status, and the static analysis runs. Those reports correspond to either the current commit in the review ref (for pending reviews), or to the last commented-upon commit (for submitted reviews).
func Get ¶
func Get(repo repository.Repo, revision string) (*Review, error)
Get returns the specified code review.
If no review request exists, the returned review is nil.
func GetCurrent ¶
func GetCurrent(repo repository.Repo) (*Review, error)
GetCurrent returns the current, open code review.
If there are multiple matching reviews, then an error is returned.
func (*Review) AddComment ¶
AddComment adds the given comment to the review.
func (*Review) GetAnalysesMessage ¶
GetAnalysesMessage returns a string summarizing the results of the most recent static analyses.
func (*Review) GetAnalysesNotes ¶
GetAnalysesNotes returns all of the notes from the most recent static analysis run recorded in the git notes.
func (*Review) GetBaseCommit ¶
GetBaseCommit returns the commit against which a review should be compared.
func (*Review) GetBuildStatusMessage ¶
GetBuildStatusMessage returns a string of the current build-and-test status of the review, or "unknown" if the build-and-test status cannot be determined.
func (*Review) GetHeadCommit ¶
GetHeadCommit returns the latest commit in a review.
func (*Review) ListCommits ¶
ListCommits lists the commits included in a review.
func (*Review) Rebase ¶
Rebase performs an interactive rebase of the review onto its target ref.
If the 'archivePrevious' argument is true, then the previous head of the review will be added to the 'refs/devtools/archives/reviews' ref prior to being rewritten. That ensures the review history is kept from being garbage collected.
func (*Review) RebaseAndSign ¶
RebaseAndSign performs an interactive rebase of the review onto its target ref. It signs the result of the rebase as well as (re)signs the review request itself.
If the 'archivePrevious' argument is true, then the previous head of the review will be added to the 'refs/devtools/archives/reviews' ref prior to being rewritten. That ensures the review history is kept from being garbage collected.
type Summary ¶
type Summary struct { Repo repository.Repo `json:"-"` Revision string `json:"revision"` Request request.Request `json:"request"` AllRequests []request.Request `json:"-"` Comments []CommentThread `json:"comments,omitempty"` Resolved *bool `json:"resolved,omitempty"` Submitted bool `json:"submitted"` }
Summary represents the high-level state of a code review.
This high-level state corresponds to the data that can be quickly read directly from the repo, so other methods that need to operate on a lot of reviews (such as listing the open reviews) should prefer operating on the summary rather than the details.
Review summaries have two status fields which are orthogonal: 1. Resolved indicates if a reviewer has accepted or rejected the change. 2. Submitted indicates if the change has been incorporated into the target.
func GetSummary ¶
func GetSummary(repo repository.Repo, revision string) (*Summary, error)
GetSummary returns the summary of the specified code review.
If no review request exists, the returned review summary is nil.
func GetSummaryViaRefs ¶
func GetSummaryViaRefs(repo repository.Repo, requestRef, commentRef, revision string) (*Summary, error)
GetSummary returns the summary of the code review specified by its revision and the references which contain that reviews summary and comments.
If no review request exists, the returned review summary is nil.
func ListAll ¶
func ListAll(repo repository.Repo) []Summary
ListAll returns all reviews stored in the git-notes.
func ListOpen ¶
func ListOpen(repo repository.Repo) []Summary
ListOpen returns all reviews that are not yet incorporated into their target refs.
func (*Summary) IsAbandoned ¶
IsAbandoned returns whether or not the given review has been abandoned.
Directories ¶
Path | Synopsis |
---|---|
Package analyses defines the internal representation of static analysis reports.
|
Package analyses defines the internal representation of static analysis reports. |
Package ci defines the internal representation of a continuous integration reports.
|
Package ci defines the internal representation of a continuous integration reports. |
Package comment defines the internal representation of a review comment.
|
Package comment defines the internal representation of a review comment. |
Package gpg provides an interface and an abstraction with which to sign and verify review requests and comments.
|
Package gpg provides an interface and an abstraction with which to sign and verify review requests and comments. |
Package request defines the internal representation of a review request.
|
Package request defines the internal representation of a review request. |