[PM-26292] tool: Add script to delete unused Localizable.strings entries#2464
[PM-26292] tool: Add script to delete unused Localizable.strings entries#2464KatherineInCode wants to merge 8 commits intomainfrom
Conversation
|
Great job! No new security vulnerabilities introduced in this pull request |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2464 +/- ##
==========================================
- Coverage 87.09% 85.96% -1.13%
==========================================
Files 1874 2104 +230
Lines 165816 180624 +14808
==========================================
+ Hits 144411 155272 +10861
- Misses 21405 25352 +3947 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
f25e6b7 to
1b5766f
Compare
1b5766f to
688112f
Compare
688112f to
87d355a
Compare
Bitwarden Claude Code ReviewOverall Assessment: APPROVE Reviewed the new |
|
|
||
|
|
||
| def _normalize_key(key: str) -> str: | ||
| """Normalize a ``.strings`` key for comparison against a SwiftGen identifier. |
There was a problem hiding this comment.
💭 Very personal take - given these scripts aren't for public distribution, these docstrings are blowing up line count without adding much, method name and the 3 comments above the regexps were enough for me at least.
There was a problem hiding this comment.
Our general MO in the codebase is to err on the side of documenting everything, even if it's private and small, so I'd prefer to keep with that trend. I can see the arguments either way, but in something like this, even if it's a pretty-niche script not for public distribution, it is still public, so I'd err on the side of over-documenting over under-documenting, especially since it calls out some of the caveats and logic and implications more than the regex alone does.

🎟️ Tracking
https://bitwarden.atlassian.net/browse/PM-26292
📔 Objective
This builds on #2412 by adding a module that finds unused strings and deletes them. I also did some refactoring of the strings file management into a separate python module.
I also ran the script, and it found 308 unused keys, many of which were identified in #2003. I'm not entirely sure why it's so many, especially of what seem like basic strings, though my guess is that some are used on Android, and a lot of them are detritus from MAUI or earlier that just never got cleaned up.
As noted in #2412, eventually we could have running these scripts be part of the CI process in some way, but currently these are still manual runs.