Skip to content

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
@netlify
Copy link

netlify bot commented Nov 12, 2024

Deploy Preview for fakerjs ready!

Name Link
🔨 Latest commit 900ce83
🔍 Latest deploy log https://app.netlify.com/projects/fakerjs/deploys/695a71ffa6e4e000081c0432
😎 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 project configuration.

@codecov
Copy link

codecov bot commented Nov 12, 2024

Codecov Report

❌ Patch coverage is 94.87179% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 99.97%. Comparing base (6ab5670) to head (900ce83).

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.97%   99.97%   -0.01%     
==========================================
  Files        2995     2995              
  Lines      236324   236347      +23     
  Branches      941      943       +2     
==========================================
+ Hits       236267   236287      +20     
- Misses         57       60       +3     
Files with missing lines Coverage Δ
src/definitions/person.ts 100.00% <ø> (ø)
src/modules/image/index.ts 100.00% <100.00%> (ø)
src/modules/person/index.ts 96.66% <94.11%> (-0.28%) ⬇️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@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

@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
Copy link
Member Author

ST-DDT commented Feb 12, 2025

Read for review

matthewmayer
matthewmayer previously approved these changes Feb 14, 2025
@matthewmayer
Copy link
Contributor

Looks good to me, but I think let's wait till after 10.2.0 is released to merge it.

Then this as well as the follow on locale changes can be part of 10.3.0.

@xDivisionByZerox
Copy link
Member

Thanks for the input @matthewmayer 👍
I'll mark this PR with do NOT merge yet Do not merge this PR into the target branch yet to prevent us from merging it for now.

@xDivisionByZerox xDivisionByZerox added the do NOT merge yet Do not merge this PR into the target branch yet label Dec 4, 2025
@matthewmayer
Copy link
Contributor

Happy for this to merge now 10.2 is out, targeting 10.3 release along with associated cleanup of the locale data.

matthewmayer
matthewmayer previously approved these changes Jan 4, 2026
@matthewmayer matthewmayer removed the do NOT merge yet Do not merge this PR into the target branch yet label Jan 4, 2026
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.

Approving this in the hope that includeGeneric will become someday default true, for political reasons, diversity and a better world I can live in.

@xDivisionByZerox xDivisionByZerox modified the milestones: vAnytime, v10.x Jan 4, 2026
@xDivisionByZerox
Copy link
Member

We might want to follow up with a draft PR that changes the default of includeGeneric to true as a breaking change for the major version (whenever this will be). Or at least create an issue for it?

Also, this PR will not show up in the changelog due to being a "refactor". We might want to rephrase the title to "feat(person): add optional parameter includeGeneric to sexType" or something similar. What do you think?

@Shinigami92
Copy link
Member

Shinigami92 commented Jan 4, 2026

We might want to follow up with a draft PR that changes the default of includeGeneric to true as a breaking change for the major version (whenever this will be). Or at least create an issue for it?

I can do this/take this. However I think we have a lot of time for that, as I'm not sure when we will start thinking about v11.

Also, this PR will not show up in the changelog due to being a "refactor". We might want to rephrase the title to "feat(person): add optional parameter includeGeneric to sexType" or something similar. What do you think?

👍 really good idea


Edit: I will open a Issue/PR when this PR here got merged

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

6 participants