mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 09:42:07 +08:00
ecdae9f863
FIX: check all .yml files in the project for integrity FIX: ensure localized yamls are compatible with english
18 lines
389 B
Ruby
18 lines
389 B
Ruby
require_relative "locale_file_walker"
|
|
|
|
class DuplicateKeyFinder < LocaleFileWalker
|
|
|
|
def find_duplicates(path)
|
|
@keys_with_count = Hash.new { 0 }
|
|
handle_document(Psych.parse_file(path))
|
|
@keys_with_count.select { |key, count| count > 1 }.keys
|
|
end
|
|
|
|
protected
|
|
|
|
def handle_scalar(node, depth, parents)
|
|
super
|
|
@keys_with_count[parents.join('.')] += 1
|
|
end
|
|
end
|