public function review(ReporterInterface $reporter, ReviewableInterface $commit) { if (substr($commit->getSubject(), -1) === '.') { $message = 'Subject line must not end with a period'; $reporter->error($message, $this, $commit); } }
public function review(ReporterInterface $reporter, ReviewableInterface $commit) { if (!preg_match('/^[A-Z]/u', $commit->getSubject())) { $message = 'Subject line must begin with a capital letter'; $reporter->error($message, $this, $commit); } }
public function review(ReporterInterface $reporter, ReviewableInterface $commit) { if (strlen($commit->getSubject()) > $this->getMaximumLength()) { $message = sprintf('Subject line is greater than %d characters', $this->getMaximumLength()); $reporter->error($message, $this, $commit); } }
public function review(ReporterInterface $reporter, ReviewableInterface $commit) { $regex = '/^(?:' . implode('|', $this->incorrect) . ')/i'; if (preg_match($regex, $commit->getSubject())) { $message = 'Subject line must use imperative present tense'; $reporter->error($message, $this, $commit); } }
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); } }