Repository navigation
CodeCompliance: send a User-Agent from IsDocumentationURLValid - #562
IsakNaslundBh merged 4 commits into
Conversation
|
@BHoMBot check required |
|
@sakanni to confirm, the following actions are now queued:
There are 1 requests in the queue ahead of you. |
|
This repository is not part of the beta package and does not require a versioning check to be performed. |
|
This repository is not part of the installer package, and does not require an installer check. |
|
@BHoMBot check copyright-compliance |
|
@sakanni to confirm, the following actions are now queued:
|
|
@sakanni to confirm, the following actions are now queued:
|
|
This repository is not part of the beta package and does not require a versioning check to be performed. |
|
@BHoMBot check null-handling |
|
@sakanni to confirm, the following actions are now queued:
|
|
@sakanni to confirm, the following actions are now queued:
There are 185 requests in the queue ahead of you. |
|
@BHoMBot check documentation-compliance |
|
@sakanni to confirm, the following actions are now queued:
There are 89 requests in the queue ahead of you. |
|
@sakanni to confirm, the following actions are now queued:
There are 88 requests in the queue ahead of you. |
IsakNaslundBh
left a comment
There was a problem hiding this comment.
Happy with this. Tested with my previously not functioning case, and this now passes.
Issues addressed by this PR
Closes #561
IsDocumentationURLValidsent its request with no User-Agent, and some sites refuse those. rics.org returns 403 to an empty or curl User-Agent and 200 to the User-Agent this check now sends, from both GitHub-hosted runners and a local machine, so valid links failed CI.The check now sends
BHoM-ComplianceCheck/1.0with a link to its documentation page, and passes on any 2xx rather than only 200. It uses one shared client with a 30 second timeout instead of a new client per attribute. The client closes each connection after use, so a long-lived host such as Grasshopper never holds pooled connections or stale DNS results, at negligible cost for the handful of links a check makes. Responses are read headers-first, so a 2xx passes without downloading the page body. Any exception still fails the link, as before.Test files
New NUnit project
.ci/unit-tests/CodeComplianceTest_Engine_Tests, added toTest_Toolkit_Tests.sln. It runs against a local HTTP listener, apart from one test that relies on the.invaliddomain never resolving (RFC 6761). Three of its seven tests fail on develop (204, a site that needs a User-Agent, and the User-Agent itself) and all seven pass here. Two of them check that anftp://link and an unresolvable host still fail without throwing. Existing tests are unchanged. The new project is not yet run by this repository's CI.Changelog
IsDocumentationURLValididentifies itself with a User-Agent and accepts any 2xx response.Additional comments
Reporting 403 and 429 as a warning instead of an error was considered and left out. With the User-Agent, the RICS link passes from GitHub runners and locally, and every other
[DocumentationURL]link found in BHoM passes when checked locally. A warning never blocks, so a link that is genuinely dead behind a site that answers 403 would go green.Not in this PR: the check reads the URL from the attribute's source text, so a valid URL written as a verbatim string, a constant or a named argument still fails as a broken link. That limitation predates this change and is unaffected by it.
Not tested: inside a real Grasshopper host, and under BHoMBot.