Skip to content

Commit

Permalink
Limit strudy link analysis to non-automatic links
Browse files Browse the repository at this point in the history
Avoids false positives à la #569 (review)
  • Loading branch information
dontcallmedom committed Mar 21, 2024
1 parent 2503446 commit 268059e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/lib/study-backrefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')) {
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/lib/study-crawl.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
Expand Down

0 comments on commit 268059e

Please sign in to comment.