esp-idf/.gitlab/dangerjs/mrSizeTooLarge.js
Tomas Sebestik dc5d4b0ac0 ci(danger-gitlab): Add CI job tracelog checks output
For role/check 'mrSourceBranchName' changed the output severity to warn (was info)
2023-09-22 10:35:24 +02:00

23 lines
750 B
JavaScript

const { recordRuleExitStatus } = require("./configParameters.js");
/**
* Check if MR is too large (more than 1000 lines of changes)
*
* @dangerjs INFO
*/
module.exports = async function () {
const ruleName = "Merge request size (number of changed lines)";
const bigMrLinesOfCodeThreshold = 1000;
const totalLines = await danger.git.linesOfCode();
if (totalLines > bigMrLinesOfCodeThreshold) {
recordRuleExitStatus(ruleName, "Passed (with suggestions)");
return message(
`This MR seems to be quite large (total lines of code: ${totalLines}), you might consider splitting it into smaller MRs`
);
}
// At this point, the rule has passed
recordRuleExitStatus(ruleName, "Passed");
};