Runs PHP-CS-Fixer in background and adds a failure if the command is failed
Checks that the Commit message matches the regex
- regex (string)
- (optional) message (string)
Checks that the commit messages are unique inside the pull request
- (optional) message (string)
Checks the commit amount in the pull request
- maxAmount (int) default: 1
- (optional) message (string)
Allows running multiple rules when a condition is met
- function which checks are the condition met
- array of rules to be executed
<?php
use Danger\Context;
use Danger\Config;
use Danger\Platform\Github\Github;
use Danger\Rule\CommitRegex;
use Danger\Rule\Condition;
use Danger\Rule\MaxCommit;
/**
* We check the commit amount and commit message only when the target platform is Github
*/
return (new Config())
->useRule(new Condition(
function (Context $context) {
return $context->platform instanceof Github;
},
[
new MaxCommit(1),
new CommitRegex('/^(feat|fix|docs|perf|refactor|compat|chore)(\(.+\))?\:\s(.{3,})/m')
]
));