Skip to content
This repository has been archived by the owner on May 20, 2023. It is now read-only.

Fail or warn if a message key is not used anywhere in the code #23

Open
amire80 opened this issue Jul 11, 2015 · 1 comment
Open

Fail or warn if a message key is not used anywhere in the code #23

amire80 opened this issue Jul 11, 2015 · 1 comment

Comments

@amire80
Copy link

amire80 commented Jul 11, 2015

It might be useful to run something like git grep in all code files (probably *.php, *.js, maybe *.rb) and to issue a warning or a fatal failure if the message key cannot be found anywhere.

Such a thing can happen if a feature that uses the message was removed or changed and the developer forgot to remove the messages from en.json.

@Krinkle
Copy link
Member

Krinkle commented Jul 11, 2015

A few ideas:

  • Build a single regex that matches all keys.
  • Use the "async" package to provide high concurrency and asynchronously read each file to match (e.g. async.eachLimit).
  • Track each match (e.g. seen[key] = true; or inverse like delete notSeen[key];).
  • Report the remaining ones. (e.g. Object.keys(notSeen);)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

2 participants