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

CU: Audit common.json and remove unused strings #9785

Merged
merged 3 commits into from
Oct 23, 2024

Conversation

juancstlm-a6
Copy link
Contributor

@juancstlm-a6 juancstlm-a6 commented Oct 3, 2024

Description of Change

Audit the common.json translation key file and look for unused strings. Using the following process.

  1. Run a script to look for matches of the keys in .ts and .tsx files and remove them from the common.json automatically
  2. For all removed keys check using the following steps 2-8
  3. Look for the key in the code and determine that it was in fact not found.
  4. Look for potential usages where the key is a constant myConstant='key' and the constant used in translation functions like getTranslation(myConstant)
  5. If the key has multiple paths i.e "." then search for each individually to identify if it is a dynamic key.
  6. If the key has variables, look for those variables being used in a translation.
  7. Check key path against known dynamic keys and ignore if it is one of the dynamic keys.
  8. Remove if it could be guaranteed that it is not used.

Screenshots/Video

N/A

Testing

  • Ran an simple yarn test to ensure that keys used in tests were not removed

  • Tested on iOS

  • Tested on Android

Reviewer Validations

If any of the removed keys are known to be dynamically generated call it out so that they can be kept and possibly refactored to a way that the translation key is not dynamically generated.

PR Checklist

Reviewer: Confirm the items below as you review

  • PR is connected to issue(s)
  • Tests are included to cover this change (when possible)
  • No magic strings (All string unions follow the Union -> Constant type pattern)
  • No secrets or API keys are checked in
  • All imports are absolute (no relative imports)
  • New functions and Redux work have proper TSDoc annotations

For QA

Run a build for this branch

@juancstlm-a6 juancstlm-a6 self-assigned this Oct 3, 2024
@juancstlm-a6 juancstlm-a6 linked an issue Oct 3, 2024 that may be closed by this pull request
@juancstlm-a6 juancstlm-a6 marked this pull request as ready for review October 3, 2024 22:32
@juancstlm-a6 juancstlm-a6 requested review from a team as code owners October 3, 2024 22:32
Sparowhawk
Sparowhawk previously approved these changes Oct 4, 2024
@github-actions github-actions bot added the FE-With QA A PR waiting for QA Activity label Oct 4, 2024
@TKDickson
Copy link
Contributor

TKDickson commented Oct 9, 2024

@juancstlm-a6 planning on testing early this new sprint, can you resolve the merge conflict so I can merge in develop & kick off a new build?

@juancstlm-a6
Copy link
Contributor Author

@TKDickson done!

@github-actions github-actions bot added FE-Ready to Merge and removed FE-With QA A PR waiting for QA Activity labels Oct 11, 2024
@Sparowhawk Sparowhawk merged commit 1a29a5b into develop Oct 23, 2024
35 of 37 checks passed
@Sparowhawk Sparowhawk deleted the CU/9614-AuditCommonJSON branch October 23, 2024 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CU - audit the common.json file and remove unused strings
3 participants