Skip to content

Remove 'validate-unused-strings' (moved to the organicmaps repo) - #29

Closed
biodranik wants to merge 2 commits into
organicmapsfrom
remove-validate-unused-strings
Closed

biodranik wants to merge 2 commits into
organicmapsfrom
remove-validate-unused-strings

Conversation

@biodranik

Copy link
Copy Markdown
Member

Remove validate-unused-strings (moved to the organicmaps repo)

The validate-unused-strings command and its twine/tools/grep.py helper are Organic-Maps-specific: they hardcode OM's localized-string accessors (GetLocalizedString, L(...), R.string), source layout, and file types. That is knowledge about the consuming codebase, not about the Twine file format — so usage detection has moved into the organicmaps repo at tools/python/validate_unused_strings.py, which reuses TwineFile only as a parser.

See organicmaps/organicmaps#12497.

The old implementation also had correctness bugs (only the first regex match per line was captured; Kotlin / .storyboard / Info.plist were not scanned), and a proper fix needs OM-side data (classificator, enums, Android lint) — i.e. it would have to reach from the submodule up into its superproject. The in-repo version fixes the bugs and avoids that inverted dependency.

Removed

  • the validate-unused-strings CLI command (twine/cli.py)
  • TwineFileRunner.validate_unused_strings + _grep_core/_grep_ios/_grep_android helpers and the OM-specific regexes (twine/runner.py)
  • twine/tools/grep.py
  • the corresponding README section

Unaffected

validate-twine-file and all generate-* / consume-* commands.

Verified

  • validate-twine-file still passes on OM's data/strings/strings.txt
  • the full test suite passes (132 tests)
  • nothing else in twine imports the removed symbols

Suggested merge order: after organicmaps/organicmaps#12497 lands, so OM is already off the old command (it currently is on that branch). OM's submodule pin doesn't reference the removed command, so order isn't strictly required.

The command and its tools/grep.py helper are Organic-Maps-specific: they
hardcode OM's localized-string accessors (GetLocalizedString, L(...),
R.string), source layout and file types. That is knowledge about the
consuming codebase, not the Twine file format, so usage detection has moved
into the organicmaps repo (tools/python/validate_unused_strings.py), which
reuses TwineFile only as a parser. See organicmaps/organicmaps#12497.

validate-twine-file and the generate/consume commands are untouched.

Signed-off-by: Alexander Borsuk <me@alex.bio>
@biodranik
biodranik requested a review from strump June 15, 2026 19:36

@strump strump left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@biodranik

Copy link
Copy Markdown
Member Author

@strump fix ruff lint action check failure?

Signed-off-by: S. Kozyr <s.trump@gmail.com>
@strump strump closed this Aug 5, 2026
@strump
strump deleted the remove-validate-unused-strings branch August 5, 2026 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants