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(finance): deprecate transactionDescription for removal #3202

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

Conversation

ST-DDT
Copy link
Member

@ST-DDT ST-DDT commented Oct 20, 2024

The transaction description method is very limited in it's applications.

The method generates multiple values from the finance module and masks and concats them together.

invoice transaction at Kilback - Durgan using card ending with ***(...4316) for UAH 783.82 in account ***16168663

I would argue, that the textual representation of these information is an implementation detail of the UI that will show it.
e.g. it would likely be displayed as

invoice transaction at Kilback - Durgan using card ending with ***(...4316) for UAH 783.82 in account ***16168663

I would consider this a method generating a complex object although it is a string. Which makes the method our of scope for Faker.

Popularity-Data from #3215

  • faker.finance.transactionDescription: 20

@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: finance Something is referring to the finance module deprecation A deprecation was made in the PR labels Oct 20, 2024
@ST-DDT ST-DDT added this to the v9.x milestone Oct 20, 2024
@ST-DDT ST-DDT requested review from a team October 20, 2024 17:37
@ST-DDT ST-DDT self-assigned this Oct 20, 2024
Copy link

netlify bot commented Oct 20, 2024

Deploy Preview for fakerjs ready!

Name Link
🔨 Latest commit 920b2da
🔍 Latest deploy log https://app.netlify.com/sites/fakerjs/deploys/671ec633ddbc2a00088065b8
😎 Deploy Preview https://deploy-preview-3202.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 Oct 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.96%. Comparing base (497cad9) to head (920b2da).

Additional details and impacted files
@@            Coverage Diff             @@
##             next    #3202      +/-   ##
==========================================
- Coverage   99.96%   99.96%   -0.01%     
==========================================
  Files        2804     2804              
  Lines      216974   216980       +6     
  Branches      962      961       -1     
==========================================
+ Hits       216903   216906       +3     
- Misses         71       74       +3     
Files with missing lines Coverage Δ
src/modules/finance/index.ts 100.00% <100.00%> (ø)

... and 2 files with indirect coverage changes

@ST-DDT
Copy link
Member Author

ST-DDT commented Oct 20, 2024

If you still need the method, please inline/copy the implementation:

transactionDescription(): string {
    const amount = faker.finance.amount();
    const company = faker.company.name();
    const transactionType = faker.finance.transactionType();
    const account = faker.finance.accountNumber();
    const card = faker.finance.creditCardNumber().replaceAll(/(?<=.{4}).(?=.{2})/g, '*');
    const currency = faker.finance.currencyCode();

    return `${transactionType} transaction at ${company} using card ending with ***${card} for ${currency} ${amount} in account ***${account}`;
  }

@ST-DDT ST-DDT added the has workaround Workaround provided or linked label Oct 20, 2024
Shinigami92
Shinigami92 previously approved these changes Oct 22, 2024
@ST-DDT ST-DDT requested a review from a team October 22, 2024 18:30
src/modules/finance/index.ts Outdated Show resolved Hide resolved
@xDivisionByZerox
Copy link
Member

Popularity-Data from #3215

  • faker.finance.transactionDescription: 20

A quick GH search says otherwise 🤔
I have to admit that some of the references are pretty plain and wouldn't suffer from the method going exstinct.

I would consider this a method generating a complex object although it is a string. Which makes the method our of scope for Faker.

I actually kind of agree with you here. BUT:

  1. we had no complains about the methods implementation so far (as far as i know)
  2. we did a lot of restructuring and deprecating during v8.0 which did upset some people as we know (2 million people are still on latest v7)

Having this method in our codebase doesn't cause a big enought pain point to call for emidiate action in my opinion.

@matthewmayer
Copy link
Contributor

I tend to agree this doesnt cause any harm and should be left alone. Perhaps we could add a note this is discouraged for new code without formally deprecating it.

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 deprecation A deprecation was made in the PR has workaround Workaround provided or linked m: finance Something is referring to the finance module p: 1-normal Nothing urgent
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants