Esempio n. 1
0
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)
			}
		}
	}
}
Esempio n. 2
0
// GetAnalysesNotes returns all of the notes from the most recent static
// analysis run recorded in the git notes.
func (r *Review) GetAnalysesNotes() ([]analyses.Note, error) {
	latestAnalyses, err := analyses.GetLatestAnalysesReport(r.Analyses)
	if err != nil {
		return nil, err
	}
	if latestAnalyses == nil {
		return nil, fmt.Errorf("No analyses available")
	}
	return latestAnalyses.GetNotes()
}
Esempio n. 3
0
// GetAnalysesNotes returns all of the notes from the most recent static
// analysis run recorded in the git notes.
func (r *Review) GetAnalysesNotes() ([]analyses.Note, error) {
	latestAnalyses, err := analyses.GetLatestAnalysesReport(r.Analyses)
	if err != nil {
		return nil, err
	}
	if latestAnalyses == nil {
		return nil, fmt.Errorf("No analyses available")
	}
	reportResults, err := latestAnalyses.GetLintReportResult()
	if err != nil {
		return nil, err
	}
	var analysesNotes []analyses.Note
	for _, reportResult := range reportResults {
		analysesNotes = append(analysesNotes, reportResult.Notes...)
	}
	return analysesNotes, nil
}
Esempio n. 4
0
// GetAnalysesMessage returns a string summarizing the results of the
// most recent static analyses.
func (r *Review) GetAnalysesMessage() string {
	latestAnalyses, err := analyses.GetLatestAnalysesReport(r.Analyses)
	if err != nil {
		return err.Error()
	}
	if latestAnalyses == nil {
		return "No analyses available"
	}
	status := latestAnalyses.Status
	if status != "" && status != analyses.StatusNeedsMoreWork {
		return status
	}
	analysesNotes, err := latestAnalyses.GetNotes()
	if err != nil {
		return err.Error()
	}
	if analysesNotes == nil {
		return "passed"
	}
	return fmt.Sprintf("%d warnings\n", len(analysesNotes))
	// TODO(ojarjur): Figure out the best place to display the actual notes
}