public function review(ReporterInterface $reporter, ReviewableInterface $commit) { $fulltext = $commit->getSubject() . PHP_EOL . $commit->getBody(); if (preg_match('/\\bwip\\b/i', $fulltext)) { $message = 'Do not commit WIP to shared branches'; $reporter->error($message, $this, $commit); } }
public function review(ReporterInterface $reporter, ReviewableInterface $commit) { $lines = preg_split('/(\\r?\\n)+/', $commit->getBody()); foreach ($lines as $line) { if ($this->isLineTooLong($line) && !$this->doesContainUrl($line)) { $message = sprintf('Body line is greater than %d characters ( "%s ..." )', $this->getMaximumLength(), substr($line, 0, 16)); $reporter->error($message, $this, $commit); } } }