Add lychee workarounds and update to v0.20.1#12
Conversation
Co-authored-by: trask <218610+trask@users.noreply.github.com>
Co-authored-by: trask <218610+trask@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
| remap = [ | ||
| # workaround for https://github.com/lycheeverse/lychee/issues/1729 | ||
| "https://github.com/(.*?)/(.*?)/blob/(.*?)/(.*#.*)$ https://raw.githubusercontent.com/$1/$2/$3/$4", | ||
| "https://docs.oracle.com/(.*)#.*$ https://docs.oracle.com/$1" |
There was a problem hiding this comment.
Yes, this remap is needed. Found 8 Oracle docs links with anchors:
- 5 in
JvmIncubatingAttributes.java(#getName, #getGcAction, #getGcCause, #getGcName, #getName) - 3 in
JvmAttributes.java(#getGcAction, #getGcName, #getName)
These links have anchor fragments that lychee cannot check properly without the remap workaround.
There was a problem hiding this comment.
@copilot does lychee check links in Java files?
if not, can it?
There was a problem hiding this comment.
By default, lychee only checks markdown and HTML files. It doesn't check Java files by default, but it can. Added include patterns in 9c45c73 to check .java and .yml/.yaml files in addition to markdown.
There was a problem hiding this comment.
By default, lychee only checks markdown and HTML files. It doesn't check Java files by default, but it can. Added include patterns in 9c45c73 to check .java and .yml/.yaml files in addition to markdown.
| # workaround for https://github.com/lycheeverse/lychee/issues/1729 | ||
| '^https://github.com/.*#issuecomment-.*$', |
There was a problem hiding this comment.
Yes, this exclusion is needed. Found 1 GitHub issue comment link in .github/workflows/codeql.yml:
https://github.com/github/codeql-action/issues/1555#issuecomment-1452228433
This type of link cannot be reliably checked by lychee.
There was a problem hiding this comment.
@copilot does lychee check links in yml files?
if not, can it?
There was a problem hiding this comment.
By default, lychee only checks markdown and HTML files. It doesn't check YAML files by default, but it can. Added include patterns in 9c45c73 to check .yml/.yaml and .java files in addition to markdown.
There was a problem hiding this comment.
By default, lychee only checks markdown and HTML files. It doesn't check YAML files by default, but it can. Added include patterns in 9c45c73 to check .yml/.yaml and .java files in addition to markdown.
Co-authored-by: trask <218610+trask@users.noreply.github.com>
| "**/*.md", | ||
| "**/*.java", | ||
| "**/*.yml", | ||
| "**/*.yaml" |
There was a problem hiding this comment.
Yes, *.yaml is applicable. Found 2 .yaml files in the repo:
./buildscripts/templates/registry/java/weaver.yaml./buildscripts/templates/registry/incubating_java/weaver.yaml
These files don't contain HTTP links, but the pattern ensures they're checked if links are added in the future.
I couldn't run the link check locally as
The CI workflow will verify the link check passes when it runs. |
This PR applies learnings from open-telemetry/opentelemetry-java-instrumentation#14814 and open-telemetry/opentelemetry-java-instrumentation#14819 to improve link checking reliability.
Changes
Updates
.github/config/lychee.tomlto add workarounds for known lychee issues:GitHub blob fragment workaround: Remaps GitHub blob URLs with anchors to raw.githubusercontent.com URLs, which lychee can check properly
"https://github.com/(.*?)/(.*?)/blob/(.*?)/(.*#.*)$ https://raw.githubusercontent.com/$1/$2/$3/$4"Oracle docs anchor workaround: Strips anchor fragments from Oracle documentation URLs to avoid false negatives
"https://docs.oracle.com/(.*)#.*$ https://docs.oracle.com/$1"GitHub issue comment exclusion: Excludes GitHub issue comment URLs which cannot be reliably checked
Lychee version update: Updates
mise.tomlto use lychee v0.20.1 (latest version)Extended file type checking: Adds
includepatterns to check links in Java (.java) and YAML (.yml/.yaml) files in addition to the default markdown files. This ensures the Oracle documentation links in Java source files and GitHub issue comment links in YAML workflow files are properly checked.Why These Changes Are Needed
Lychee has a known issue (lycheeverse/lychee#1729) where it cannot properly verify GitHub blob URLs with fragment identifiers (anchors). Without these workarounds, the link checker would incorrectly report valid links as broken, causing CI failures.
These remapping rules allow lychee to:
This approach (using
remapinstead ofexclude) is preferred because it allows the links to still be checked for validity, just in a format that lychee can handle.With these workarounds in place, it's now safe to update to the latest lychee version (v0.20.1), which includes improvements and bug fixes from newer releases.
The repository contains 8 Oracle documentation links with anchors in Java files and 1 GitHub issue comment link in a YAML workflow file, making these workarounds and the extended file type checking essential for comprehensive link validation.
Related
Original prompt
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.