2023-02-21 07:56:09 +00:00
|
|
|
/**
|
|
|
|
* Check if MR has not an excessive numbers of commits (if squashed)
|
|
|
|
*
|
|
|
|
* @dangerjs INFO
|
|
|
|
*/
|
|
|
|
module.exports = function () {
|
2023-03-08 10:00:04 +00:00
|
|
|
const tooManyCommitThreshold = 2; // above this number of commits, squash commits is suggested
|
2023-02-21 07:56:09 +00:00
|
|
|
const mrCommits = danger.gitlab.commits;
|
|
|
|
|
|
|
|
if (mrCommits.length > tooManyCommitThreshold) {
|
|
|
|
return message(
|
|
|
|
`You might consider squashing your ${mrCommits.length} commits (simplifying branch history).`
|
|
|
|
);
|
|
|
|
}
|
|
|
|
};
|