From 268059e418c4ca0469fd203a702b9d4004710dba Mon Sep 17 00:00:00 2001 From: Dominique Hazael-Massieux Date: Thu, 21 Mar 2024 08:49:27 +0100 Subject: [PATCH] Limit strudy link analysis to non-automatic links MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Avoids false positives à la https://github.com/w3c/strudy/pull/569#pullrequestreview-1905719338 --- src/lib/study-backrefs.js | 8 ++++---- src/lib/study-crawl.js | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/lib/study-backrefs.js b/src/lib/study-backrefs.js index 66105a53..b35a0dab 100644 --- a/src/lib/study-backrefs.js +++ b/src/lib/study-backrefs.js @@ -240,12 +240,12 @@ function studyBackrefs (edResults, trResults = [], htmlFragments = {}) { const recordAnomaly = recordCategorizedAnomaly(report, 'links', possibleAnomalies); edResults.forEach(spec => { - Object.keys(spec.links || {}) + Object.keys(spec.links?.rawlinks || {}) .filter(matchSpecUrl) .forEach(link => { let shortname; - if (spec.links[link].specShortname) { - shortname = spec.links[link].specShortname; + if (spec.links.rawlinks[link].specShortname) { + shortname = spec.links.rawlinks[link].specShortname; } else { let nakedLink = link; if (nakedLink.endsWith('.html')) { @@ -348,7 +348,7 @@ function studyBackrefs (edResults, trResults = [], htmlFragments = {}) { const ids = sourceSpec.ids || []; // Check anchors - const anchors = spec.links[link].anchors || []; + const anchors = spec.links.rawlinks[link].anchors || []; for (const anchor of anchors) { const baseLink = (sourceSpec.nightly?.url === link || sourceSpec.nightly?.pages?.includes(link)) ? link : sourceSpec.nightly?.url; const matchFullNightlyLink = matchAnchor(baseLink, anchor); diff --git a/src/lib/study-crawl.js b/src/lib/study-crawl.js index 0077ec77..4a5ec215 100644 --- a/src/lib/study-crawl.js +++ b/src/lib/study-crawl.js @@ -272,7 +272,7 @@ function studyCrawlResults(results, options = {}) { // Links to external specifications within the body of the spec // that do not have a corresponding entry in the references // (all links to external specs should have a companion ref) - missingLinkRef: Object.keys(spec.links) + missingLinkRef: Object.keys(spec.links.rawlinks || {}) .filter(matchSpecUrl) .filter(l => { // Filter out "good" and "inconsistent" references @@ -293,7 +293,7 @@ function studyCrawlResults(results, options = {}) { // which the reference uses a different URL, e.g. because the // link targets the Editor's Draft, whereas the reference // targets the latest published version - inconsistentRef: Object.keys(spec.links) + inconsistentRef: Object.keys(spec.links.rawlinks || {}) .filter(matchSpecUrl) .map(l => { const canonSimple = canonicalizeUrl(l);