Class: I18n::Hygiene::Checks::KeyUsage
- Defined in:
- lib/i18n/hygiene/checks/key_usage.rb
Overview
Ensures that existing translations are actually used.
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from I18n::Hygiene::Checks::Base
Instance Method Details
#run ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/i18n/hygiene/checks/key_usage.rb', line 14 def run key_usage_checker = I18n::Hygiene::KeyUsageChecker.new( directories: config.directories, exclude_files: config.exclude_files, file_extensions: config.file_extensions ) wrapper = I18n::Hygiene::Wrapper.new( exclude_keys: config.exclude_keys, exclude_scopes: config.exclude_scopes ) Parallel.each(wrapper.keys_to_check(config.primary_locale), in_threads: config.concurrency) do |key| if key_usage_checker.used?(key) yield Result.new(:pass, message: ".") else = ErrorMessageBuilder.new .title("Unused translation") .key(key) .create yield Result.new(:failure, message: ) end end end |