$file_provider = $scm->getFileProvider($old_rev); $file_provider->excludePaths($exclude_paths); $total_report = $lint_engine->getReport($file_provider); } } else { // main loop over all files // list of files to check (in order): // 1) command-line arguments, 2) config-defined project.source-code-dir 3) current dir $paths = $arguments; if (!$paths) { $paths = XRef::getConfigValue("project.source-code-dir", array()); } if (!$paths) { $paths = array("."); } $file_provider = new XRef_FileProvider_FileSystem($paths); $file_provider->excludePaths($exclude_paths); $total_report = $lint_engine->getReport($file_provider); } // calculate some stats foreach ($total_report as $file_name => $report) { $filesWithDefects++; foreach ($report as $code_defect) { if ($code_defect->severity == XRef::NOTICE) { $numberOfNotices++; } elseif ($code_defect->severity == XRef::WARNING) { $numberOfWarnings++; } elseif ($code_defect->severity == XRef::ERROR || $code_defect->severity == XRef::FATAL) { $numberOfErrors++; } else { error_log("Unknown severity: {$code_defect->severity}");
} 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) { try { $file_content = $file_provider->getFileContent($filename); $pf = $xref->getParsedFile($filename, $file_content); foreach ($plugins as $pluginId => $plugin) { $plugin->generateFileReport($pf); } $numberOfFiles++; $numberOfCodeLines += $pf->getNumberOfLines();