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

Validate relative links with docs tests #28561

Closed
HonkingGoose opened this issue Apr 21, 2024 · 5 comments · Fixed by #28690
Closed

Validate relative links with docs tests #28561

HonkingGoose opened this issue Apr 21, 2024 · 5 comments · Fixed by #28690
Assignees
Labels
priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others type:docs Documentation

Comments

@HonkingGoose
Copy link
Collaborator

Describe the proposed change(s).

Creating this issue as asked by @viceice in this comment:

We should check if all relative links in our Markdown files (*.md) are correct, this makes sure that the published docs has working links. This check should be automated, via tests or configuration of existing tools.

The mkdocs dependency in our renovatebot/renovatebot.github.io repository already warns us about some bad link types, here's the relevant snippet: 1

# Build settings

# Halt processing when a warning is raised when building the docs.
# https://www.mkdocs.org/user-guide/configuration/#strict
strict: true

# Use MkDocs maintainer's recommended strictness settings for link validation.
# https://www.mkdocs.org/user-guide/configuration/#validation

validation:
  omitted_files: warn
  absolute_links: warn
  unrecognized_links: warn

mkdocs already warns about bad relative links, but we only see that warning output when we (or Renovate) create a new docs build in the docs repo... So that warning can't help you decide if a PR is good to merge. 🙃

We have a documentation.spec.ts file that has some docs specific tests. I don't see code that tests for relative links?

Footnotes

  1. mkdocs.yml config file on renovatebot.github.io repository

@HonkingGoose HonkingGoose added priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others type:docs Documentation labels Apr 21, 2024
@HonkingGoose
Copy link
Collaborator Author

I don't know enough to work on this issue.

@viceice if you want to work on this, please assign yourself to the issue. 😉

@viceice viceice self-assigned this Apr 26, 2024
@viceice
Copy link
Member

viceice commented Apr 26, 2024

will start working on it today

WARNING -  Doc file 'modules/manager/devcontainer/index.md' contains a relative link '../dockerfile/readme.md', but the target 'modules/manager/dockerfile/readme.md' is not found among documentation files.
WARNING -  Doc file 'modules/manager/devcontainer/index.md' contains a relative link '../docker-compose/readme.md', but the target 'modules/manager/docker-compose/readme.md' is not found among documentation files.

@viceice
Copy link
Member

viceice commented Apr 30, 2024

We also need to validate anchors, see

@viceice
Copy link
Member

viceice commented Apr 30, 2024

INFO    -  Doc file 'configuration-options.md' contains a link './self-hosted-configuration.md#allowedEnv', but the doc 'self-hosted-configuration.md' does not contain an anchor '#allowedEnv'.
INFO    -  Doc file 'configuration-options.md' contains a link './self-hosted-configuration.md#allowedHeaders', but the doc 'self-hosted-configuration.md' does not contain an anchor '#allowedHeaders'.
INFO    -  Doc file 'configuration-options.md' contains a link './getting-started/running.md#githubcom-token-for-release-notes', but the doc 'getting-started/running.md' does not contain an anchor '#githubcom-token-for-release-notes'.
INFO    -  Doc file 'self-hosted-configuration.md' contains a link './self-hosted-experimental.md#renovatexs3endpoint', but the doc 'self-hosted-experimental.md' does not contain an anchor '#renovatexs3endpoint'.
INFO    -  Doc file 'self-hosted-configuration.md' contains a link './self-hosted-experimental.md#renovatexs3pathstyle', but the doc 'self-hosted-experimental.md' does not contain an anchor '#renovatexs3pathstyle'.
INFO    -  Doc file 'getting-started/private-packages.md' contains a link '../self-hosted-configuration.md#detectHostRulesFromEnv', but the doc 'self-hosted-configuration.md' does not contain an anchor '#detectHostRulesFromEnv'.

@renovate-release
Copy link
Collaborator

🎉 This issue has been resolved in version 37.330.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others type:docs Documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants