/** * Allows specific build types (e.g. Github) to report violations back to their respective services. * @param Builder $builder * @param $plugin * @param $message * @param int $severity * @param null $file * @param null $lineStart * @param null $lineEnd * @return BuildError */ public function reportError(Builder $builder, $plugin, $message, $severity = BuildError::SEVERITY_NORMAL, $file = null, $lineStart = null, $lineEnd = null) { unset($builder); $error = new BuildError(); $error->setBuild($this); $error->setCreatedDate(new \DateTime()); $error->setPlugin($plugin); $error->setMessage($message); $error->setSeverity($severity); $error->setFile($file); $error->setLineStart($lineStart); $error->setLineEnd($lineEnd); return Factory::getStore('BuildError')->save($error); }
protected function processTechnicalDebtMeta(BuildMeta $meta) { $data = json_decode($meta->getMetaValue(), true); if (is_array($data) && count($data)) { foreach ($data as $error) { $buildError = new BuildError(); $buildError->setBuildId($meta->getBuildId()); $buildError->setPlugin('technical_debt'); $buildError->setCreatedDate(new \DateTime()); $buildError->setFile($error['file']); $buildError->setLineStart($error['line']); $buildError->setSeverity(BuildError::SEVERITY_NORMAL); $buildError->setMessage($error['message']); $this->errorStore->save($buildError); } } }