Only make HTTP/s links as info messages

This commit is contained in:
Cat /dev/Nulo 2022-11-25 19:05:24 -03:00
parent 13ef15c275
commit 3eb55ca4dd

View file

@ -9,7 +9,11 @@ const dirPath = argv[2] || ".";
function recurseElement(report, el) {
if (el.name === "a") {
if (el.attribs.href) {
checkUrl(report, "link", el, el.attribs.href);
if (isHttp(el.attribs.href)) {
report.infos.push(`HTTP/S link: ${getHtml(el)}`);
} else if (isAbsolute(el.attribs.href)) {
report.warnings.push(`Absolute link: ${getHtml(el)}`);
}
} else {
report.warnings.push(`Link with no href: ${getHtml(el)}`);
}
@ -64,6 +68,7 @@ function processFile(content) {
} else {
let report = {
warnings: [],
infos: [],
};
for (const el of dom) {
if (el.type === "tag") {