/** * @param array $data */ private function reportErrors(array $data) { foreach ($data as $test) { if ($test['pass']) { continue; } $message = explode('::', $test['message']); $this->build->reportError($this->phpci, 'stage_test', sprintf('Test "%s" failed.', $message[1]), BuildError::SEVERITY_CRITICAL, $message[0]); } }
/** * Report all of the errors we've encountered line-by-line. * @param $output */ protected function reportErrors($output) { foreach ($output as $error) { $message = 'Class ' . $error['class'] . ' does not have a Docblock comment.'; if ($error['type'] == 'method') { $message = 'Method ' . $error['class'] . '::' . $error['method'] . ' does not have a Docblock comment.'; } $this->build->reportError($this->phpci, $error['file'], $error['line'], $message); } }
/** * Report all of the errors we've encountered line-by-line. * @param $output */ protected function reportErrors($output) { foreach ($output as $error) { $message = 'Class ' . $error['class'] . ' is missing a docblock.'; $severity = PHPCI\Model\BuildError::SEVERITY_LOW; if ($error['type'] == 'method') { $message = $error['class'] . '::' . $error['method'] . ' is missing a docblock.'; $severity = PHPCI\Model\BuildError::SEVERITY_NORMAL; } $this->build->reportError($this->phpci, 'php_docblock_checker', $message, $severity, $error['file'], $error['line']); } }
/** * Process PHPMD's XML output report. * @param $xmlString * @return array * @throws \Exception */ protected function processReport($xmlString) { $xml = simplexml_load_string($xmlString); if ($xml === false) { $this->phpci->log($xmlString); throw new \Exception('Could not process PHPMD report XML.'); } $warnings = 0; foreach ($xml->file as $file) { $fileName = (string) $file['name']; $fileName = str_replace($this->phpci->buildPath, '', $fileName); foreach ($file->violation as $violation) { $warnings++; $this->build->reportError($this->phpci, 'php_mess_detector', (string) $violation, PHPCI\Model\BuildError::SEVERITY_HIGH, $fileName, (int) $violation['beginline'], (int) $violation['endline']); } } return $warnings; }
/** * Process JSHint's XML output report. * @param $xmlString * @return array * @throws \Exception */ protected function processReport($xmlString) { $xml = simplexml_load_string($xmlString); if ($xml === false) { $this->phpci->log($xmlString); throw new \Exception('Could not process JSHint report XML.'); } $warnings = 0; $data = array(); foreach ($xml->file as $file) { $fileName = (string) $file['name']; $fileName = str_replace($this->phpci->buildPath, '', $fileName); foreach ($file->error as $error) { $warnings++; $warning = array('file' => $fileName, 'line' => (int) $error['line'], 'severity' => (string) $error['severity'], 'message' => (string) $error['message']); $this->build->reportError($this->phpci, $fileName, (int) $error['line'], (string) $error['message']); $data[] = $warning; } } return array($warnings, $data); }
/** * Process PHPMD's XML output report. * @param $xmlString * @return array * @throws \Exception */ protected function processReport($xmlString) { $xml = simplexml_load_string($xmlString); if ($xml === false) { $this->phpci->log($xmlString); throw new \Exception('Could not process PHPMD report XML.'); } $warnings = 0; $data = array(); foreach ($xml->file as $file) { $fileName = (string) $file['name']; $fileName = str_replace($this->phpci->buildPath, '', $fileName); foreach ($file->violation as $violation) { $warnings++; $warning = array('file' => $fileName, 'line_start' => (int) $violation['beginline'], 'line_end' => (int) $violation['endline'], 'rule' => (string) $violation['rule'], 'ruleset' => (string) $violation['ruleset'], 'priority' => (int) $violation['priority'], 'message' => (string) $violation); $this->build->reportError($this->phpci, $fileName, (int) $violation['beginline'], (string) $violation); $data[] = $warning; } } return array($warnings, $data); }