protected function validate(RuleBook $ruleBook, Repository $repository, IO $io) : void
    {
        // if this is a merge commit skip enforcing message rules
        if ($repository->isMerging()) {
            return;
        }

        $problems = $ruleBook->validate($repository->getCommitMsg());

        if (count($problems)) {
            $io->writeError($this->getErrorOutput($problems, $repository));
            throw new ActionFailed('Commit message validation failed');
        }
        $io->write('<info>All rules passed</info>');
    }
protected function validate(RuleBook $ruleBook, Repository $repository, IO $io) : void
    {
        // if this is a merge commit skip enforcing message rules
        if ($repository->isMerging()) {
            return;
        }

        $problems = $ruleBook->validate($repository->getCommitMsg());

        if (count($problems)) {
            $io->writeError($this->getErrorOutput($problems, $repository));
            throw new ActionFailed('Commit message validation failed');
        }
        $io->write('<info>All rules passed</info>');
    }
protected function validate ( RuleBook $ ruleBook , Repository $ repository , IO $ io ) : void { // if this is a merge commit skip enforcing message rules if ( $ repository -> isMerging ( ) ) { return ; } $ problems = $ ruleBook -> validate ( $ repository -> getCommitMsg ( ) ) ; if ( count ( $ problems ) ) { $ io -> writeError ( $ this -> getErrorOutput ( $ problems , $ repository ) ) ; throw new ActionFailed ( 'Commit message validation failed' ) ; } $ io -> write ( '<info>All rules passed</info>' ) ; }
Validate the message

@param  \CaptainHook\App\Hook\Message\RuleBook $ruleBook
@param  \SebastianFeldmann\Git\Repository      $repository
@param  \CaptainHook\App\Console\IO            $io
@return void
@throws \CaptainHook\App\Exception\ActionFailed
Validate the message