Esempio n. 1
0
    // $errors: array(file name => XRef_CodeDefect[])
    $errors = array();
    $file_provider_old = $scm->getFileProvider($old_rev);
    $file_provider_new = $scm->getFileProvider($current_rev);
    $file_provider_new->excludePaths($exclude_paths);
    $file_provider_new->excludePaths($exclude_paths);
    $modified_files = $scm->getListOfModifiedFiles($old_rev, $current_rev);
    $lint_engine = XRef::getConfigValue("xref.project-check", true) ? new XRef_LintEngine_ProjectCheck($xref) : new XRef_LintEngine_Simple($xref);
    if ($incremental) {
        // incremental mode - find only the errors that are new from the old version of the same file
        $errors = $lint_engine->getIncrementalReport($file_provider_old, $file_provider_new, $modified_files);
    } else {
        // normal mode - report about every error in file
        $errors = $lint_engine->getReport($file_provider_new);
    }
    if (count($errors)) {
        if (XRef::verbose()) {
            error_log(count($errors) . " file(s) with errors found");
        }
        list($recipients, $subject, $body, $headers) = $xref->getNotificationEmail($errors, $branch_name, $old_rev, $current_rev);
        foreach ($recipients as $to) {
            mail($to, $subject, $body, $headers);
        }
        $db["numberOfSentLetters"]++;
    }
    // save the database on each iteration/branch:
    // if we die for whatever reason (memory?), don't spam about already processed branches
    $db["branches"][$branch_name] = $current_rev;
    $storage->saveData("ci", "database", $db);
}
$storage->releaseLock("ci");
Esempio n. 2
0
 public static function setVerbose($verbose)
 {
     self::$verbose = $verbose;
 }