Class: Ea::Cli::Command::Validate

Inherits:
Base
  • Object
show all
Defined in:
lib/ea/cli/command/validate.rb

Overview

ea validate FILE

Runs Ea::Qea::Validation::ValidationEngine and reports messages. Exits non-zero if any errors were found.

Requires lutaml-uml (validation runs against Lutaml::Uml::Document).

Constant Summary collapse

COLUMNS =
%i[severity entity_type entity_name message].freeze

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Ea::Cli::Command::Base

Instance Method Details

#callObject



15
16
17
18
19
20
21
22
# File 'lib/ea/cli/command/validate.rb', line 15

def call
  result = parse_with_validation(file_path)
  rows = result.messages.map do |m|
    [m.severity, m.entity_type, m.entity_name, m.message]
  end
  formatter.render(rows, columns: COLUMNS)
  exit(1) if result.errors.any?
end