Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default (parsed, when) => {
// Flunk if no footer is found
if (!parsed.footer) {
return [true];
}
const negated = when === 'never';
const rawLines = toLines(parsed.raw);
const bodyLines = toLines(parsed.body);
const bodyOffset = bodyLines.length > 0 ? rawLines.indexOf(bodyLines[0]) : 1;
const [leading] = rawLines.slice(bodyLines.length + bodyOffset);
// Check if the first line of footer is empty
const succeeds = leading === '';
return [
negated ? !succeeds : succeeds,
message(['footer', negated ? 'may not' : 'must', 'have leading blank line'])
];
};
export default (parsed, when) => {
// Flunk if no body is found
if (!parsed.body) {
return [true];
}
const negated = when === 'never';
const [leading] = toLines(parsed.raw).slice(1);
// Check if the first line of body is empty
const succeeds = leading === '';
return [
negated ? !succeeds : succeeds,
message(['body', negated ? 'may not' : 'must', 'have leading blank line'])
];
};
export default (parsed, when) => {
// Flunk if no footer is found
if (!parsed.footer) {
return [true];
}
const negated = when === 'never';
const rawLines = toLines(parsed.raw);
const bodyLines = toLines(parsed.body);
const bodyOffset = bodyLines.length > 0 ? rawLines.indexOf(bodyLines[0]) : 1;
const [leading] = rawLines.slice(bodyLines.length + bodyOffset);
// Check if the first line of footer is empty
const succeeds = leading === '';
return [
negated ? !succeeds : succeeds,
message(['footer', negated ? 'may not' : 'must', 'have leading blank line'])
];
};
export default (parsed, when, value) => {
const lines = toLines(parsed.raw).filter(Boolean);
const last = lines[lines.length - 1];
const negated = when === 'never';
const hasSignedOffBy = last.startsWith(value);
return [
negated ? !hasSignedOffBy : hasSignedOffBy,
message(['message', negated ? 'must not' : 'must', 'be signed off'])
];
};