[docs-utils] 4️⃣ Add param doc mismatch validation#250820
Merged
clintandrewhall merged 3 commits intoelastic:mainfrom Feb 11, 2026
Merged
[docs-utils] 4️⃣ Add param doc mismatch validation#250820clintandrewhall merged 3 commits intoelastic:mainfrom
clintandrewhall merged 3 commits intoelastic:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds validation for incomplete parameter documentation in function declarations. The new paramDocMismatches check identifies functions where some parameters have JSDoc descriptions while others don't, encouraging consistent documentation practices.
Changes:
- Adds
paramDocMismatchesfield toApiStatsto track functions with incomplete parameter documentation - Introduces
IssuesByPlugininterface to consolidate issue collections passed tocollectApiStatsForPlugin - Implements
isFunctionLike()andtrackParamDocMismatches()helpers to detect and flag functions with partial parameter documentation
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/kbn-docs-utils/src/types.ts | Adds paramDocMismatches to ApiStats and defines IssuesByPlugin interface |
| packages/kbn-docs-utils/src/stats.ts | Refactors function signature to use IssuesByPlugin, implements parameter documentation validation logic |
| packages/kbn-docs-utils/src/stats.test.ts | Adds comprehensive test coverage for the new validation including edge cases |
| packages/kbn-docs-utils/src/integration_tests/api_doc_suite.test.ts | Updates integration tests to use refactored API |
| packages/kbn-docs-utils/src/integration_tests/snapshots/*.mdx | Updates snapshot dates to reflect test execution time |
| packages/kbn-docs-utils/src/integration_tests/snapshots/plugin_a.stats.json | Adds baseline data for detected parameter documentation mismatches |
| packages/kbn-docs-utils/src/integration_tests/fixtures/src/plugin_a/public/*.ts | Documents expected validation failures in fixture comments |
| packages/kbn-docs-utils/src/cli/tasks/collect_stats.ts | Updates to use new IssuesByPlugin interface |
| packages/kbn-docs-utils/src/cli/tasks/collect_stats.test.ts | Initializes paramDocMismatches in mock stats |
| packages/kbn-docs-utils/src/test_helpers/mocks.ts | Adds paramDocMismatches to mock factory functions |
| packages/kbn-docs-utils/src/README.md | Updates documentation to reflect validation capabilities |
| packages/kbn-docs-utils/scripts/update_fixture_comments.js | Registers new validation category for fixture comment generation |
| @@ -1,25 +1,26 @@ | |||
| # Autogenerated API documentation | |||
| # Autogenerated API documentation. | |||
There was a problem hiding this comment.
Corrected 'Autogenerated' to 'Auto-generated'.
Suggested change
| # Autogenerated API documentation. | |
| # Auto-generated API documentation. |
eb88dfd to
95845b8
Compare
13 tasks
95845b8 to
771d747
Compare
Contributor
|
Pinging @elastic/kibana-operations (Team:Operations) |
771d747 to
645da0c
Compare
Contributor
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]
History
|
- Add paramDocMismatches field to ApiStats. - Add trackParamDocMismatches function. - Update integration tests
645da0c to
0bea7f0
Compare
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a new
paramDocMismatchesvalidation tokbn-docs-utilsthat flags functions where not all parameters have JSDoc documentation. This complements the existingmissingCommentscheck, which only flags APIs that are completely undocumented.Note
This PR is a subset of #247688 for ease of review.
This PR was written with Cursor and
claude-4.5-opus-high.Important
This PR relies on #250810 and includes it as its base commit. This PR will remain draft until that PR is merged and this branch is rebased.
Before / After Example
Given these TypeScript functions:
Before this PR:
No validation existed for partially-documented parameters.
missingCommentsonly flagged APIs with no description at all:{ "counts": { "missingComments": 0 } } // getUser passes silently despite incomplete param docs!After this PR:
Functions with incomplete parameter documentation are flagged:
{ "counts": { "missingComments": 0, "paramDocMismatches": 1 // ✅ getUser flagged! }, "paramDocMismatches": [ { "id": "def-public.getUser", "label": "getUser", "type": "Function", "lineNumber": 8 } // search NOT flagged (all params documented) // log NOT flagged (no params documented - all-or-nothing is OK) ] }Detection Logic
@param@parammissingCommentsif no description)@paramWhy This Matters
Partial parameter documentation is worse than no documentation:
Changes
ApiStats.paramDocMismatches: New field to track functions with incomplete parameter documentationisFunctionLike(): Helper function that detects function declarations and function-typed aliases by checking forTypeKind.FunctionKindor=>in the signaturetrackParamDocMismatches(): Collects functions where some (but not all) parameters have descriptionsupdate_fixture_comments.jsto include the newparamDocMismatchescategoryImpact
--check commentsflag incheck_package_docs