Class: Glossarist::Validation::Rules::L10nUuidIntegrityRule
- Defined in:
- lib/glossarist/validation/rules/l10n_uuid_integrity_rule.rb
Instance Method Summary collapse
- #applicable?(context) ⇒ Boolean
- #category ⇒ Object
- #check(context) ⇒ Object
- #code ⇒ Object
- #scope ⇒ Object
- #severity ⇒ Object
Methods inherited from Base
Instance Method Details
#applicable?(context) ⇒ Boolean
12 13 14 |
# File 'lib/glossarist/validation/rules/l10n_uuid_integrity_rule.rb', line 12 def applicable?(context) context.collection_context.localization_index.any? end |
#category ⇒ Object
8 |
# File 'lib/glossarist/validation/rules/l10n_uuid_integrity_rule.rb', line 8 def category = :integrity |
#check(context) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/glossarist/validation/rules/l10n_uuid_integrity_rule.rb', line 16 def check(context) concept = context.concept fname = context.file_name lc_map = concept.data.localized_concepts || {} lc_index = context.collection_context.localization_index issues = [] lc_map.each do |lang, uuid| next if lc_index.key?(uuid) issues << issue( "localized_concepts '#{lang}' => '#{uuid}' has no matching file", code: code, severity: severity, location: fname, suggestion: "Add the missing localization file or remove the UUID", ) end issues end |
#code ⇒ Object
7 |
# File 'lib/glossarist/validation/rules/l10n_uuid_integrity_rule.rb', line 7 def code = "GLS-018" |
#scope ⇒ Object
10 |
# File 'lib/glossarist/validation/rules/l10n_uuid_integrity_rule.rb', line 10 def scope = :concept |
#severity ⇒ Object
9 |
# File 'lib/glossarist/validation/rules/l10n_uuid_integrity_rule.rb', line 9 def severity = "error" |