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

feat(docs): add validation of xrefs to docfx command #6658

Merged
merged 7 commits into from
Jun 6, 2024

Conversation

bshaffer
Copy link
Contributor

@bshaffer bshaffer commented Sep 25, 2023

Adds a validate method to the docs generation, which throws an error when it encounters broken or invalid xref references.

The check will fail for any improperly formatted references, and if it can't find the class, it will fail for handwritten classes and GAPIC clients, but only output warnings for broken references in protobuf messages. This is because there are too many broken references in protobuf for us to even begin to fix them all. We will want to fix these in the protos themselves eventually (or at least file bugs for the API teams to fix them)

Also updates to the latest phpdoc.

@bshaffer bshaffer marked this pull request as ready for review May 3, 2024 20:31
@bshaffer bshaffer requested review from a team as code owners May 3, 2024 20:31
@bshaffer bshaffer added the next release PRs to be included in the next release label May 3, 2024
@bshaffer bshaffer removed the next release PRs to be included in the next release label Jun 5, 2024
@bshaffer bshaffer added the next release PRs to be included in the next release label Jun 6, 2024
foreach ($this->getInvalidXrefs($node->getContent()) as $invalidRef) {
if (isset(self::$allowedReferenceFailures[$node->getFullname()])
&& self::$allowedReferenceFailures[$node->getFullname()] == $invalidRef) {
// these links are inexplicably broken in phpdoc generation, and will require more investigation
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's create a ticket for this one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a tricky situation because the issue (I think) is in phpdoc itself... but there's no indication AFAIK for why this would happen (they look identical to the other xrefs). It's absolutely baffling.

Before I can file an issue with phpdoc, I need to do more investigation to see if I can find out what could be causing it. Because I truly have no clue.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Filed an issue in #7377

@bshaffer bshaffer merged commit 9b419c4 into main Jun 6, 2024
24 checks passed
@bshaffer bshaffer deleted the add-docs-ref-validation branch June 6, 2024 21:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
next release PRs to be included in the next release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants