Exemple #1
0
XRef::registerCmdOption('r:', "report-level=", '-r, --report-level=', "either 'error', 'warning' or 'notice'");
XRef::registerCmdOption('', "no-cache", '--no-cache', "don't use lint cache, if any");
XRef::registerCmdOption('', "init", '--init', "create a config file, init cache");
XRef::registerCmdOption('', "git", '--git', "git pre-commit mode: find new errors in modified tracked files");
XRef::registerCmdOption('', "git-cached", '--git-cached', "git pre-commit mode: compare files cached for commit with HEAD");
XRef::registerCmdOption('', "git-rev=", '--git-rev=<rev> or --git-rev=<from>:<to> ', array("", "find errors in revision <rev>, or find errors added since rev <from> to rev <to>"));
try {
    list($options, $arguments) = XRef::getCmdOptions();
} catch (Exception $e) {
    error_log($e->getMessage());
    error_log("See 'xref-lint --help'");
    exit(1);
}
if (XRef::needHelp()) {
    $program = basename($argv[0]);
    XRef::showHelpScreen("xref-lint - tool to find problems in PHP source code", "{$program} [options] [files to check]");
    exit(1);
}
if (isset($options['init'])) {
    $xref = new XRef();
    $xref->init();
    exit(0);
}
//
// report-level:  errors, warnings or notices
// Option -r <value> is a shortcut for option -d lint.report-level=<value>
if (isset($options['report-level'])) {
    XRef::setConfigValue("lint.report-level", $options['report-level']);
}
//
// output-format: text or json
Exemple #2
0
 *
 * @author Igor Gariev <*****@*****.**>
 * @copyright Copyright (c) 2013 Igor Gariev
 * @licence http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
 */
$includeDir = "@php_dir@" == "@" . "php_dir@" ? dirname(__FILE__) . "/.." : "@php_dir@/XRef";
require_once "{$includeDir}/XRef.class.php";
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);
Exemple #3
0
 * @copyright Copyright (c) 2013 Igor Gariev
 * @licence http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
 */
$includeDir = "@php_dir@" == "@" . "php_dir@" ? dirname(__FILE__) . "/.." : "@php_dir@/XRef";
require_once "{$includeDir}/XRef.class.php";
// command-line arguments
try {
    list($options, $arguments) = XRef::getCmdOptions();
} catch (Exception $e) {
    error_log($e->getMessage());
    error_log("See 'xref-doc --help'");
    exit(1);
}
//help
if (XRef::needHelp() || count($arguments)) {
    XRef::showHelpScreen("xref-doc - tool to create cross-reference source code reports");
    exit(1);
}
$xref = new XRef();
$xref->setOutputDir(XRef::getConfigValue("doc.output-dir"));
$xref->loadPluginGroup("doc");
$plugins = $xref->getPlugins("XRef_IDocumentationPlugin");
$path = XRef::getConfigValue("project.source-code-dir");
$file_provider = new XRef_FileProvider_FileSystem($path);
$exclude_paths = XRef::getConfigValue("project.exclude-path", array());
$file_provider->excludePaths($exclude_paths);
$numberOfFiles = 0;
$numberOfCodeLines = 0;
// 1. Call each plugin once for each input file
$files = $xref->filterFiles($file_provider->getFiles());
foreach ($files as $filename) {