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

infra: improve error messages for parameter properties #3082

Merged
merged 9 commits into from
Sep 9, 2024

Conversation

ST-DDT
Copy link
Member

@ST-DDT ST-DDT commented Sep 1, 2024

Partially fixes #3079

Adds distinct error references for option parameter's properties and outputs them to the github action errors.

@ST-DDT ST-DDT added p: 1-normal Nothing urgent c: infra Changes to our infrastructure or project setup labels Sep 1, 2024
@ST-DDT ST-DDT added this to the vAnytime milestone Sep 1, 2024
@ST-DDT ST-DDT requested review from a team September 1, 2024 19:41
@ST-DDT ST-DDT self-assigned this Sep 1, 2024
Copy link

netlify bot commented Sep 1, 2024

Deploy Preview for fakerjs ready!

Name Link
🔨 Latest commit 804f735
🔍 Latest deploy log https://app.netlify.com/sites/fakerjs/deploys/66df7c922466f90008d92282
😎 Deploy Preview https://deploy-preview-3082.fakerjs.dev
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

codecov bot commented Sep 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.96%. Comparing base (f128d77) to head (804f735).
Report is 1 commits behind head on next.

Additional details and impacted files
@@           Coverage Diff            @@
##             next    #3082    +/-   ##
========================================
  Coverage   99.95%   99.96%            
========================================
  Files        2776     2776            
  Lines      226260   226260            
  Branches      587      939   +352     
========================================
+ Hits       226164   226185    +21     
+ Misses         96       75    -21     

see 1 file with indirect coverage changes

@ST-DDT ST-DDT force-pushed the infra/generate/property-errors branch from 331c196 to 1e6b792 Compare September 1, 2024 20:01
@ST-DDT
Copy link
Member Author

ST-DDT commented Sep 1, 2024

I also added an error notification to the script:

grafik

@ST-DDT
Copy link
Member Author

ST-DDT commented Sep 1, 2024

Any wishes regarding the two error message parts (mainText + causeText)?

Copy link
Member

@Shinigami92 Shinigami92 left a comment

Choose a reason for hiding this comment

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

I would potentially still be a bit confused when I would encounter such a causeText, but I see that you just pass forward the error.message. So for now this is fine for me.

scripts/consts.ts Outdated Show resolved Hide resolved
@ST-DDT
Copy link
Member Author

ST-DDT commented Sep 2, 2024

I would potentially still be a bit confused when I would encounter such a causeText

The causeText is just defined in a different location.

`Expected exactly one element for ${property}, got ${input.length}`

Would the following be easier to understand?

`Expected exactly one ${property} element, got ${input.length}`
`Expected exactly one jsdoc element, got 0`

(I have to check the other usages still)

@matthewmayer
Copy link
Contributor

I think the real confusion is that it is not intuitive that you have to write the JSDocs for the option parameters twice, once at the top of the method and once directly above each option. So this is an improvement, but still not sure that a new contributor confronted with this message would know how to fix it.

@ST-DDT
Copy link
Member Author

ST-DDT commented Sep 6, 2024

How about an error like this:

FakerApiDocsProcessingError: Failed to process property 'options.min' at src/modules/number/index.ts:48:11 : Expected exactly one jsdocs element, got 0. Please ensure that each method signature has JSDocs, and that all properties of option/object parameters are documented with both @param tags and inline JSDocs.

@Shinigami92
Copy link
Member

How about an error like this:

FakerApiDocsProcessingError: Failed to process property 'options.min' at src/modules/number/index.ts:48:11 : Expected exactly one jsdocs element, got 0. Please ensure that each method signature has JSDocs, and that all properties of option/object parameters are documented with both @param tags and inline JSDocs.

This is BY FAR EXORBITANT much better 😍

@ST-DDT ST-DDT requested a review from a team September 6, 2024 13:10
Copy link
Member

@xDivisionByZerox xDivisionByZerox left a comment

Choose a reason for hiding this comment

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

Great work @ST-DDT 👏

@wedouglas

This comment has been minimized.

@ST-DDT ST-DDT enabled auto-merge (squash) September 9, 2024 22:54
@ST-DDT ST-DDT merged commit acb8b52 into next Sep 9, 2024
21 checks passed
@ST-DDT ST-DDT deleted the infra/generate/property-errors branch September 9, 2024 22:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: infra Changes to our infrastructure or project setup p: 1-normal Nothing urgent
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Non-intuitive error if options property doesn't have jsdocs
5 participants