Exemple #1
0
$review->files($git->getStagedFiles());
echo PHP_EOL;
$climate = new CLImate();
$warnings = $errors = $info = 0;
if ($reporter->hasIssues()) {
    foreach ($reporter->getIssues() as $issue) {
        /** @var Issue $issue */
        if ($issue->getLevel() == Issue::LEVEL_INFO) {
            (new Process('git add ' . $issue->getSubject()->getName()))->run();
            ++$info;
        }
        if ($issue->getLevel() == Issue::LEVEL_WARNING) {
            ++$warnings;
        }
        if ($issue->getLevel() == Issue::LEVEL_ERROR) {
            $climate->backgroundRed($issue->getMessage());
            ++$errors;
        }
    }
}
if ($errors > 0) {
    $climate->backgroundRed('✘ Review has found errors.');
} elseif ($warnings > 0) {
    $climate->yellow('Review has found warnings.');
} elseif ($info > 0) {
    $climate->green('Review has found some problems and fixed them manually.');
} else {
    $climate->green('✔ Looking good. Have you tested everything?');
}
// Check if any issues were found.
// Exit with a non-zero to block the commit.