Exemplo n.º 1
0
 public function __construct(XRef $xref, $use_cache = true)
 {
     $this->xref = $xref;
     // do we have a storage manager?
     if ($use_cache) {
         try {
             $this->storageManager = $xref->getStorageManager();
         } catch (Exception $e) {
             // NOP
         }
     }
     // error map (error code => error description)
     // TODO: make it static
     $this->plugins = $xref->getPlugins("XRef_ILintPlugin");
     $this->fillErrorMap($this->plugins);
     $this->stats = array('total_files' => 0, 'parsed_files' => 0, 'cache_hit' => 0);
 }
Exemplo n.º 2
0
try {
    list($options, $arguments) = XRef::getCmdOptions();
} catch (Exception $e) {
    error_log($e->getMessage());
    error_log("See 'xref-ci --help'");
    exit(1);
}
if (XRef::needHelp() || count($arguments)) {
    XRef::showHelpScreen("xref-ci - continuous integration server");
    exit(1);
}
$incremental = XRef::getConfigValue("ci.incremental", false);
$xref = new XRef();
$xref->loadPluginGroup("lint");
$scm = $xref->getSourceCodeManager();
$storage = $xref->getStorageManager();
$exclude_paths = XRef::getConfigValue("project.exclude-path", array());
//
// Normal run:
// Find modified files from the last run and find new errors in these files
//
if (!$storage->getLock("ci")) {
    error_log("Can't obtain lock - already running?");
    exit(0);
}
$db = $storage->restoreData("ci", "database");
if (!$db) {
    // initialize the database
    $db = array();
    $db["branches"] = $scm->getListOfBranches();
    $db["numberOfSentLetters"] = 0;