func (arc Arcanist) mirrorStatusesForEachCommit(r review.Review, commitToDiffIDMap map[string]int) {
	for commitHash, diffID := range commitToDiffIDMap {
		ciNotes := r.Repo.GetNotes(ci.Ref, commitHash)
		ciReports := ci.ParseAllValid(ciNotes)
		latestCIReport, err := ci.GetLatestCIReport(ciReports)
		if err != nil {
			log.Println("Failed to load the continuous integration reports: " + err.Error())
		} else if latestCIReport != nil {
			arc.reportUnitResults(diffID, *latestCIReport)
		}

		analysesNotes := r.Repo.GetNotes(analyses.Ref, commitHash)
		analysesReports := analyses.ParseAllValid(analysesNotes)
		latestAnalysesReport, err := analyses.GetLatestAnalysesReport(analysesReports)
		if err != nil {
			log.Println("Failed to load the static analysis reports: " + err.Error())
		} else if latestAnalysesReport != nil {
			lintResults, err := latestAnalysesReport.GetLintReportResult()
			if err != nil {
				log.Println("Failed to load the static analysis reports: " + err.Error())
			} else {
				arc.reportLintResults(diffID, lintResults)
			}
		}
	}
}
Beispiel #2
0
// Details returns the detailed review for the given summary.
func (r *Summary) Details() (*Review, error) {
	review := Review{
		Summary: r,
	}
	currentCommit, err := review.GetHeadCommit()
	if err == nil {
		review.Reports = ci.ParseAllValid(review.Repo.GetNotes(ci.Ref, currentCommit))
		review.Analyses = analyses.ParseAllValid(review.Repo.GetNotes(analyses.Ref, currentCommit))
	}
	return &review, nil
}
Beispiel #3
0
// Get returns the specified code review.
//
// If no review request exists, the returned review is nil.
func Get(repo repository.Repo, revision string) *Review {
	requestNotes := repo.GetNotes(request.Ref, revision)
	requests := request.ParseAllValid(requestNotes)
	if requests == nil {
		return nil
	}
	review := Review{
		Repo:     repo,
		Revision: revision,
		Request:  requests[len(requests)-1],
	}
	review.Comments = review.loadComments()
	review.Resolved = updateThreadsStatus(review.Comments)
	review.Submitted = repo.IsAncestor(revision, review.Request.TargetRef)
	currentCommit, err := review.GetHeadCommit()
	if err == nil {
		review.Reports = ci.ParseAllValid(repo.GetNotes(ci.Ref, currentCommit))
		review.Analyses = analyses.ParseAllValid(repo.GetNotes(analyses.Ref, currentCommit))
	}
	return &review
}