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

refactor(person): refine usage of PersonEntryDefinitions #3259

Open
wants to merge 12 commits into
base: next
Choose a base branch
from

Conversation

ST-DDT
Copy link
Member

@ST-DDT ST-DDT commented Nov 12, 2024

Fixes #3058

Next steps: #3266

Meeting-Notes: 2024-11-07


This PR tries to lay the foundation of what is considered generic and what is specifically sexed:

  • Generic: Values that can be attributed to/used by either of male or female persons. (e.g. Dr.)
  • Female/Male: Values that can be attributed to specifically female/male (e.g. Mrs./Mr.)

It also changes the way how definitions are selected:

  • If generic is requested: Then only values that are specifically generic are returned, unless there are no such values.
  • If female/male is requested: Then the method will mostly (80%) return female/male values with some (20%) generic values sprinkled in. Since generic can explicitly be both, the generic elements don't cause any issues.

Please check whether the definitions/jsdoc are clear regarding their intentions and if you consider this definition to be correct.
We will clean up the locale data in separate PRs as this might affect lots of files/locales.

@ST-DDT ST-DDT added p: 1-normal Nothing urgent c: refactor PR that affects the runtime behavior, but doesn't add new features or fixes bugs m: person Something is referring to the person module labels Nov 12, 2024
@ST-DDT ST-DDT added this to the vAnytime milestone Nov 12, 2024
@ST-DDT ST-DDT requested review from a team November 12, 2024 21:33
@ST-DDT ST-DDT self-assigned this Nov 12, 2024
Copy link

netlify bot commented Nov 12, 2024

Deploy Preview for fakerjs ready!

Name Link
🔨 Latest commit fb732cc
🔍 Latest deploy log https://app.netlify.com/sites/fakerjs/deploys/67577427677997000966a365
😎 Deploy Preview https://deploy-preview-3259.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 Nov 12, 2024

Codecov Report

Attention: Patch coverage is 94.11765% with 2 lines in your changes missing coverage. Please review.

Project coverage is 99.97%. Comparing base (8b2976f) to head (fb732cc).

Files with missing lines Patch % Lines
src/modules/person/index.ts 94.11% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             next    #3259   +/-   ##
=======================================
  Coverage   99.96%   99.97%           
=======================================
  Files        2806     2806           
  Lines      217076   217095   +19     
  Branches      968      976    +8     
=======================================
+ Hits       217003   217035   +32     
+ Misses         73       60   -13     
Files with missing lines Coverage Δ
src/definitions/person.ts 100.00% <ø> (ø)
src/modules/person/index.ts 96.66% <94.11%> (-0.28%) ⬇️

... and 2 files with indirect coverage changes

@matthewmayer
Copy link
Contributor

matthewmayer commented Nov 14, 2024

I understand wanting to keep this PR small but I think it's difficult to decide if this is the right approach without reviewing what locale files will need to be updated too.

To clarify with this approach would we require the "generic", "female" and "male" options never have any items in common?

@ST-DDT
Copy link
Member Author

ST-DDT commented Nov 14, 2024

Team Decision

We will change the sexType method to return all SexType values.
A parameter includeGeneric: boolean = false can be used to control the inclusion of generic in the results.
We will check in v10 whether we want to change the default for includeGeneric based on code usage?

ST-DDT: Will create a stacked PR for the locale changes.

  • Things in both female and male -> generic
  • Things in generic -> remove from female and male
  • Without manual changes
  • The stacked PR might be later split in smaller chunks to help with reviewability

src/definitions/person.ts Outdated Show resolved Hide resolved
@ST-DDT
Copy link
Member Author

ST-DDT commented Nov 15, 2024

ST-DDT: Will create a stacked PR for the locale changes.

[...]

  • Without manual changes
  • The stacked PR might be later split in smaller chunks to help with reviewability

@xDivisionByZerox Currently, the person files aren't sorted, so this by itself causes a massive diff.
Should we sort them first? Would you like to create a PR for that or should I?

(Maybe start with only sorting first, because the cleanup PR will use the list for filtering: See #3266 (comment))

@ST-DDT ST-DDT requested a review from a team November 15, 2024 13:13
@xDivisionByZerox
Copy link
Member

@xDivisionByZerox Currently, the person files aren't sorted, so this by itself causes a massive diff.
Should we sort them first? Would you like to create a PR for that or should I?

Please go ahead. I'm not available during the weekend, sadly.

@ST-DDT
Copy link
Member Author

ST-DDT commented Nov 16, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: refactor PR that affects the runtime behavior, but doesn't add new features or fixes bugs m: person Something is referring to the person module p: 1-normal Nothing urgent
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Clean up generic prefixes
4 participants