Files
freeCodeCamp/validation/guide-folder-checks/create-error-msg.js

29 lines
977 B
JavaScript
Raw Normal View History

2018-11-20 15:31:28 -08:00
const dedent = require("dedent");
const createErrorMsg = (errors, user) => {
let errorMsgHeader = dedent`
Hi @${user},
Thanks for this pull request (PR).
Unfortunately, these changes have failed some of our recommended guidelines. Please correct the issue(s) listed below, so we can consider merging your content.
| Issue | Description | File Path |
| :---: | --- | --- |
`;
let errorMsgTable = errors.reduce((msgStr, { msg, fullPath }, idx) => {
return (msgStr += "\n" + dedent`
| ${idx + 1} | ${msg} | ${fullPath} |
`);
}, "");
let errorMsgFooter = dedent`
2018-11-22 01:19:02 +05:30
P.S: I am just friendly bot. Review our [Guidelines for Contributing](https://github.com/FreeCodeCamp/FreeCodeCamp/blob/master/CONTRIBUTING.md) and reach out to the [Contributors Chat room](https://gitter.im/FreeCodeCamp/Contributors) for more help.
2018-11-20 15:31:28 -08:00
`;
return errorMsgHeader + errorMsgTable + "\n\n" + errorMsgFooter;
};
module.exports = { createErrorMsg };