Raku / doc-website

Tooling to build/run the documentation website
Artistic License 2.0
7 stars 10 forks source link

error report external link check is disabled #402

Closed coke closed 4 weeks ago

coke commented 1 month ago

Let's enable it - it's only running the test at build time, we do want to fix any broken external links.

finanalyst commented 1 month ago

@coke this option alone can take 5-10 minutes. Each external link takes a significant time (several seconds) for the ping to the site and back again. There are some tens of links in all the files. I'll create a PR on dev-docs. That should do a test run and we can see the result.

coke commented 1 month ago

This seems like a lot of processing time just to get a positive server response; We can leave it disabled here and I can add it (back?) to the link checker that's in the repo. Let's do that, and you can focus on other things.

On Sun, Jul 14, 2024 at 5:37 PM Richard Hainsworth @.***> wrote:

@coke https://github.com/coke this option alone can take 5-10 minutes. Each external link takes a significant time (several seconds) for the ping to the site and back again. There are some tens of links in all the files. I'll create a PR on dev-docs. That should do a test run and we can see the result.

— Reply to this email directly, view it on GitHub https://github.com/Raku/doc-website/issues/402#issuecomment-2227490145, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAMIUK5XNXENTOYV6SMGNLZMLVTJAVCNFSM6AAAAABK2WD672VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMRXGQ4TAMJUGU . You are receiving this because you were mentioned.Message ID: @.***>

finanalyst commented 1 month ago

Enabling is easy. In Website/configs/03-plugin-options change link-error-test ... :no-remote to :!no-remote

finanalyst commented 1 month ago

The following is the sub called for each link:


    sub test-remote($url --> Str ) {
        state $http = LibCurl::HTTP.new;
        my $resp;
        try {
            $resp = $http.HEAD($url).perform.response-code;
        }
        if $! {
            $resp = $http.error;
        }
        # return blank if any stringified response code
        return '' if ?(+$resp);
        # any numerical response code indicates http link is live
        # failures with non 404 ok as well.
        return '' if ($resp ~~ / \:\s(\d\d\d) / and +$0 != 404);
        $resp
    }
coke commented 4 weeks ago

Closing - we can run this particular test in the docs repo now, which makes it easier to add to CI.