Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linter-rules/local-refs-exists says to fix links mentioned, but no links mentioned #4378

Open
gkellogg opened this issue Feb 4, 2023 · 3 comments

Comments

@gkellogg
Copy link
Member

gkellogg commented Feb 4, 2023

Is your feature request related to a problem? Please describe.
I'm trying to find broken local references that the linter mentions but nothing reports on those references specifically missing.

Describe the solution you'd like
In local-refs-exist.js run(), it would be useful if a warning was shown for each offendingElement.

Additional context

Running locally:

 respec -s "http://localhost:8000/rdf-xml/spec/index.html?specStatus=WD" -o /dev/null --verbose -t 20 -e -w
[INFO] [Timeout: 20000ms] Processing resource: http://localhost:8000/rdf-xml/spec/index.html?specStatus=WD ...
[INFO] [Timeout: 19999ms] Launching browser
[INFO] [Timeout: 19272ms] Navigating to http://localhost:8000/rdf-xml/spec/index.html?specStatus=WD
[INFO] [Timeout: 18233ms] Navigation complete.
[INFO] [Timeout: 18167ms] Using ReSpec v32.7.0
[INFO] [Timeout: 18166ms] Processing ReSpec document...
[ERROR] undefined
[INFO] [Timeout: 16555ms] Processed document.
[WARNING] Broken local reference found in document.
   Count: 94
  Plugin: core/linter-rules/local-refs-exist
    Hint: Please fix the links mentioned.
[WARNING] W3C Recommendation track documents require a separate “Privacy Considerations” section.
  Plugin: w3c/linter-rules/required-sections
    Hint: Add a <section> with a “Privacy Considerations” header. See the [Horizontal review guidelines](https://www.w3.org/Guide/documentreview/#how_to_get_horizontal_review).
        If the document is not intended for the W3C Recommendation track, set [noRecTrack](https://respec.org/docs/#noRecTrack) to true
        or turn off the [required-sections](https://respec.org/docs/#required-sections) linter rule.
[WARNING] W3C Recommendation track documents require a separate “Security Considerations” section.
  Plugin: w3c/linter-rules/required-sections
    Hint: Add a <section> with a “Security Considerations” header. See the [Horizontal review guidelines](https://www.w3.org/Guide/documentreview/#how_to_get_horizontal_review).
        If the document is not intended for the W3C Recommendation track, set [noRecTrack](https://respec.org/docs/#noRecTrack) to true
        or turn off the [required-sections](https://respec.org/docs/#required-sections) linter rule.
[INFO] [Timeout: 15548ms] Done.
[FATAL] Error: Errors found during processing.
    at run (/opt/homebrew/lib/node_modules/respec/tools/respec2html.js:247:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Describe any alternatives you've considered
I can get some results from https://validator.w3.org/checklink, but if ReSpec doesn't exit properly, it may fail. Couldn't find a reasonable and up-to-date local alternative.

Oddly, checklink reports no problems.

Can you or your organization fund the work or help with development?
Sadly, no.

There are three options to get your feature implemented. You can:

  1. contribute to the project yourself via a pull request. We will guide you!
  2. fund a contributor to prioritize your feature (usually US$500+ depending on complexity).
  3. wait for someone to get to it (usually a few months).
    Funding pays for the feature development, testing, documentation, server costs, etc. We have an open collective where development costs are tracked and shared. Please see our Open Collective.

I could do a PR, if this was generally thought worthwhile. Maybe I'm missing something.

@sidvishnoi
Copy link
Member

That's something I tried to solve in #3409, but it's a bit more complex that I had time for.

For now you'd have to rely on ReSpec UI in browser.

As an alternative to #3409, we can probably show:

  • offending element's ID (but that can be noisy when ReSpec auto-generates random ones),
  • or some matching selector (like section#some-id > a[href="some-link"]{some text}, but it's complicated to get a good short and meaningful selector),
  • or fallback to innerHTML (which is good only for small content like links).

@sidvishnoi
Copy link
Member

Oddly, checklink reports no problems.

That's something to investigate. There might be something that runs before linter that either breaks the linter or something that runs after linter that fixes those links.

@gkellogg
Copy link
Member Author

gkellogg commented Feb 4, 2023

So, the problem I'm having isn't because of bad links, but an odd issue that happens when you include a reference to SAX. Note the generated document https://gist.githack.com/gkellogg/0f8eb7f0f261da402683f42fa09f38ac/raw/3239ca348989318a91a6517d06e4c5e336dad8dc/sax-problem.html based on a one-line modification to the ReSpec basic.html example.

<p>Reference to [[SAX]].</p>

Even though SAX is in specref, it generates an error somewhere in ReSpec, which also reports as missing local anchors due to an expectation for a bibliographic reference for SAX, which isn't there. Remove [[SAX]] and the problem goes away.

"SAX": "D. Megginson, et al. <a href=\"http://www.megginson.com/downloads/SAX/\"><cite>SAX: The Simple API for XML</cite></a>. May 1998. URL: <a href=\"http://www.megginson.com/downloads/SAX/\"> http://www.megginson.com/downloads/SAX/</a>",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants