Class: Glossarist::Validation::Rules::ExtensionalDefinitionRule
- Defined in:
- lib/glossarist/validation/rules/extensional_definition_rule.rb
Overview
Validates that extensional definitions do not contain open-ended
wording, per ISO 704:2022 §6.4.5.1. An extensional definition
must be an EXHAUSTIVE enumeration — open-ended wordings like
..., etc., and so on, and similar, and others,
including violate this principle because they imply the
enumeration is incomplete.
Mirrors concept-model's check-definition-rules
§6.4.5.1 open-ended-wording check, exposed as a consumer-side
Validation::Rule.
Scope: concept (rule runs once per concept). Inspects every
DetailedDefinition with type: extensional across all of the
concept's localized definitions.
Constant Summary collapse
- OPEN_ENDED_PATTERNS =
ISO 704:2022 §6.4.5.1 — patterns that signal incomplete enumeration in an extensional definition. The list is intentionally conservative: only wordings that clearly indicate "more exist beyond what's listed."
[ /\.\.\./, # ellipsis /\betc\b\.?/i, # etc / etc. /\band\s+similar\b/i, # and similar /\band\s+so\s+on\b/i, # and so on /\band\s+the\s+like\b/i, # and the like /\band\s+others?\b/i, # and other / and others /\bsuch\s+as\b/i, # such as (often partial) /\bincluding\b/i, # including (often partial) /\be\.?g\.?\b/i, # e.g. / eg ].freeze
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
42 43 44 45 46 |
# File 'lib/glossarist/validation/rules/extensional_definition_rule.rb', line 42 def applicable?(context) return false unless context.concept.is_a?(V3::ManagedConcept) concept_has_extensional_definition?(context.concept) end |
#category ⇒ Object
38 |
# File 'lib/glossarist/validation/rules/extensional_definition_rule.rb', line 38 def category = :schema |
#check(context) ⇒ Object
48 49 50 51 52 53 54 55 56 |
# File 'lib/glossarist/validation/rules/extensional_definition_rule.rb', line 48 def check(context) issues = [] each_extensional_definition(context.concept) do |l10n_lang, defn, path| check_definition(defn, l10n_lang, path, context.file_name, issues) end issues end |
#code ⇒ Object
37 |
# File 'lib/glossarist/validation/rules/extensional_definition_rule.rb', line 37 def code = "GLS-223" |
#scope ⇒ Object
40 |
# File 'lib/glossarist/validation/rules/extensional_definition_rule.rb', line 40 def scope = :concept |
#severity ⇒ Object
39 |
# File 'lib/glossarist/validation/rules/extensional_definition_rule.rb', line 39 def severity = "warning" |