Repositories

Omar Jarjur <ojarjur@google.com>
9dd6e3 Fix golint errors
Omar Jarjur committed at 2016-01-08 18:50:31

Modified commands/output/output.go

@@ -105,7 +105,7 @@ func showThread(r *review.Review, thread review.CommentThread) error {
}
lines := strings.Split(contents, "\n")
if comment.Location.Range.StartLine <= uint32(len(lines)) {
var firstLine uint32 = 0
var firstLine uint32
lastLine := comment.Location.Range.StartLine
if lastLine > contextLineCount {
firstLine = lastLine - contextLineCount

Modified repository/mock_repo.go

@@ -74,6 +74,7 @@ type mockRepoForTest struct {
Notes map[string]map[string]string `json:"notes,omitempty"`
}
// NewMockRepoForTest returns a mocked-out instance of the Repo interface that has been pre-populated with test data.
func NewMockRepoForTest() Repo {
commitA := mockCommit{
Message: "First commit",

Modified review/analyses/analyses.go

@@ -43,29 +43,35 @@ type Report struct {
Version int `json:"v,omitempty"`
}
// LocationRange represents the location within a source file that an analysis message covers.
type LocationRange struct {
StartLine int `json:"start_line,omitempty"`
}
// Location represents the location within a source tree that an analysis message covers.
type Location struct {
Path string `json:"path,omitempty"`
Range *LocationRange `json:"range,omitempty"`
}
// Note represents a single analysis message.
type Note struct {
Location *Location `json:"location,omitempty"`
Category string `json:"category,omitempty"`
Description string `json:"description"`
}
// AnalyzeResponse represents the response from a static-analysis tool.
type AnalyzeResponse struct {
Notes []Note `json:"note,omitempty"`
}
// ReportDetails represents an entire static analysis run (which might include multiple analysis tools).
type ReportDetails struct {
AnalyzeResponse []AnalyzeResponse `json:"analyze_response,omitempty"`
}
// GetLintReportResult downloads the details of a lint report and returns the responses embedded in it.
func (lintReport Report) GetLintReportResult() ([]AnalyzeResponse, error) {
if lintReport.URL == "" {
return nil, nil

Modified review/review.go

@@ -190,7 +190,7 @@ func (r *Summary) loadComments() []CommentThread {
return buildCommentThreads(commentsByHash)
}
// Get returns the summary of the specified code review.
// GetSummary returns the summary of the specified code review.
//
// If no review request exists, the returned review summary is nil.
func GetSummary(repo repository.Repo, revision string) (*Summary, error) {