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

[api-extractor] Add a new message "ae-undocumented" #4370

Merged
merged 5 commits into from
Oct 1, 2023

Conversation

octogonz
Copy link
Collaborator

Summary

Requested in this Zulip thread.

Although API Extractor already flags undocumented items in the .api.md file as // (undocumented), @leordev wants to detect them via the Extractor.invoke() API for CI validation.

How it was tested

The ae-undocumented message defaults to logLevel=none, so I modified a test project to use logLevel=warning and confirmed that it is printed correctly.

Impacted documentation

Need to add this message to the website.

@leordev
Copy link

leordev commented Sep 30, 2023

This is great, thank you so much for this PR! Testing ae-undocumented with loglevel = warning against my repo at this snapshot generated my desired outcome report:

TBDocs Report

🛑 Errors: 0
⚠️ Warnings: 20

https://github.com/TBD54566975/tbdocs/blob/f3084665b16aec32cfbfbe628cfea4636daed281/src/index.ts

📄 File: src/docs-generator.ts
⚠️ extractor:ae-undocumented: Missing documentation for "generateDocs". #L20
📄 File: src/docs-report/index.ts
⚠️ extractor:ae-undocumented: Missing documentation for "runDocsReport". #L12
📄 File: src/docs-report/interfaces.ts
⚠️ extractor:ae-undocumented: Missing documentation for "DocsReporterType". #L2
⚠️ extractor:ae-undocumented: Missing documentation for "DocsGeneratorType". #L5
⚠️ extractor:ae-undocumented: Missing documentation for "DocsReport". #L8
⚠️ extractor:ae-undocumented: Missing documentation for "reporter". #L9
⚠️ extractor:ae-undocumented: Missing documentation for "errorsCount". #L10
⚠️ extractor:ae-undocumented: Missing documentation for "warningsCount". #L11
⚠️ extractor:ae-undocumented: Missing documentation for "messages". #L12
⚠️ extractor:ae-undocumented: Missing documentation for "MessageCategory". #L16
⚠️ extractor:ae-undocumented: Missing documentation for "MessageLevel". #L19
⚠️ extractor:ae-undocumented: Missing documentation for "ReportMessage". #L22
⚠️ extractor:ae-undocumented: Missing documentation for "level". #L23
⚠️ extractor:ae-undocumented: Missing documentation for "category". #L24
⚠️ extractor:ae-undocumented: Missing documentation for "messageId". #L25
⚠️ extractor:ae-undocumented: Missing documentation for "text". #L26
⚠️ extractor:ae-undocumented: Missing documentation for "sourceFilePath". #L27
⚠️ extractor:ae-undocumented: Missing documentation for "sourceFileLine". #L28
⚠️ extractor:ae-undocumented: Missing documentation for "sourceFileColumn". #L29
⚠️ extractor:ae-undocumented: Missing documentation for "context". #L30

Copy link

@leordev leordev left a comment

Choose a reason for hiding this comment

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

LGTM, worked as intended for my goals and reviewing the code it makes sense to me (but take it with huge grains of salt, since I'm not familiar with the repo).

Thank you so much for the support on this PR.

…ndocumented

# Conflicts:
#	build-tests/install-test-workspace/workspace/common/pnpm-lock.yaml
@octogonz octogonz merged commit aa04bcc into main Oct 1, 2023
@octogonz octogonz deleted the octogonz/ae-undocumented branch October 1, 2023 02:34
@octogonz
Copy link
Collaborator Author

octogonz commented Oct 1, 2023

@leordev this was released with API Extractor 7.38.0 🚀

@leordev
Copy link

leordev commented Oct 13, 2023

@octogonz I just realized that this is also warning non exposed members, in my particular case private class members:

  • ⚠️ extractor:ae-undocumented: Missing documentation for "_metadata".
  • ⚠️ extractor:ae-undocumented: Missing documentation for "_data".
  • ⚠️ extractor:ae-undocumented: Missing documentation for "_signature".

This is my class definition:

export class MyClass<T> {
  private _metadata: ResourceMetadata<T>
  private _data: ResourceKindModel<T>
  private _signature: string

  // ...
}

Is it possible to set it only for exposed APIs? Maybe through configuration?

@octogonz
Copy link
Collaborator Author

@octogonz I just realized that this is also warning non exposed members, in my particular case private class members:

* ⚠️ `extractor:ae-undocumented`: Missing documentation for "_metadata".

* ⚠️ `extractor:ae-undocumented`: Missing documentation for "_data".

* ⚠️ `extractor:ae-undocumented`: Missing documentation for "_signature".

This is my class definition:

export class MyClass<T> {
  private _metadata: ResourceMetadata<T>
  private _data: ResourceKindModel<T>
  private _signature: string

  // ...
}

Is it possible to set it only for exposed APIs? Maybe through configuration?

This is a bug. It is not intentional behavior.

@octogonz
Copy link
Collaborator Author

Here is a fix: #4392

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants