ea 0.6.154 → 0.6.155
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/ea/cli/app.rb +8 -2
- data/lib/ea/cli/command/base.rb +1 -3
- data/lib/ea/cli/command/convert.rb +2 -2
- data/lib/ea/cli/command/diagrams.rb +4 -4
- data/lib/ea/cli/command/export.rb +1 -1
- data/lib/ea/cli/command/info.rb +1 -1
- data/lib/ea/cli/command/list.rb +2 -2
- data/lib/ea/cli/command/render.rb +1 -2
- data/lib/ea/cli/command/svg.rb +1 -1
- data/lib/ea/cli/command/validate.rb +1 -3
- data/lib/ea/cli/error.rb +1 -1
- data/lib/ea/cli/output.rb +1 -1
- data/lib/ea/diagram/display_config.rb +1 -1
- data/lib/ea/export/json/generator.rb +5 -5
- data/lib/ea/export/json_schema/generator.rb +2 -2
- data/lib/ea/export/plantuml/generator.rb +2 -2
- data/lib/ea/fonts/metrics.rb +3 -4
- data/lib/ea/lint/rules/cyclic_generalization.rb +1 -1
- data/lib/ea/lint/rules/duplicate_name.rb +1 -1
- data/lib/ea/lint/rules/missing_stereotype.rb +4 -3
- data/lib/ea/lint/rules/naming_convention.rb +11 -11
- data/lib/ea/lint/rules/orphan_element.rb +6 -6
- data/lib/ea/mdg/document.rb +0 -1
- data/lib/ea/mdg/loader.rb +0 -1
- data/lib/ea/mdg/xml/technology.rb +1 -1
- data/lib/ea/mdg/xml.rb +0 -1
- data/lib/ea/mdg.rb +0 -1
- data/lib/ea/model/document.rb +2 -2
- data/lib/ea/model/ghost_label.rb +0 -1
- data/lib/ea/model/legend.rb +1 -1
- data/lib/ea/model/property.rb +1 -1
- data/lib/ea/qea/benchmark.rb +9 -13
- data/lib/ea/qea/database.rb +26 -28
- data/lib/ea/qea/factory/association_builder.rb +5 -5
- data/lib/ea/qea/factory/association_transformer.rb +3 -6
- data/lib/ea/qea/factory/attribute_transformer.rb +3 -3
- data/lib/ea/qea/factory/base_transformer.rb +4 -4
- data/lib/ea/qea/factory/class_transformer.rb +5 -5
- data/lib/ea/qea/factory/constraint_transformer.rb +2 -2
- data/lib/ea/qea/factory/data_type_transformer.rb +5 -7
- data/lib/ea/qea/factory/diagram_transformer.rb +3 -7
- data/lib/ea/qea/factory/document_builder.rb +33 -37
- data/lib/ea/qea/factory/ea_to_uml_factory.rb +12 -18
- data/lib/ea/qea/factory/enum_transformer.rb +1 -2
- data/lib/ea/qea/factory/generalization_builder.rb +9 -9
- data/lib/ea/qea/factory/generalization_transformer.rb +3 -5
- data/lib/ea/qea/factory/instance_transformer.rb +3 -8
- data/lib/ea/qea/factory/operation_transformer.rb +2 -4
- data/lib/ea/qea/factory/package_transformer.rb +3 -3
- data/lib/ea/qea/factory/reference_resolver.rb +1 -1
- data/lib/ea/qea/factory/stereotype_loader.rb +1 -5
- data/lib/ea/qea/file_detector.rb +6 -12
- data/lib/ea/qea/infrastructure/database_connection.rb +1 -3
- data/lib/ea/qea/infrastructure/schema_reader.rb +4 -4
- data/lib/ea/qea/infrastructure/table_reader.rb +1 -1
- data/lib/ea/qea/models/ea_attribute.rb +1 -2
- data/lib/ea/qea/models/ea_attribute_tag.rb +1 -2
- data/lib/ea/qea/models/ea_author.rb +1 -1
- data/lib/ea/qea/models/ea_diagram_link.rb +4 -8
- data/lib/ea/qea/models/ea_diagram_object.rb +3 -4
- data/lib/ea/qea/models/ea_document.rb +4 -5
- data/lib/ea/qea/models/ea_glossary.rb +1 -1
- data/lib/ea/qea/models/ea_list.rb +1 -1
- data/lib/ea/qea/models/ea_object.rb +2 -2
- data/lib/ea/qea/models/ea_object_constraint.rb +1 -2
- data/lib/ea/qea/models/ea_object_property.rb +1 -2
- data/lib/ea/qea/models/ea_operation.rb +1 -2
- data/lib/ea/qea/models/ea_phase.rb +1 -1
- data/lib/ea/qea/models/ea_script.rb +5 -6
- data/lib/ea/qea/models/ea_tagged_value.rb +2 -3
- data/lib/ea/qea/models/ea_version.rb +1 -1
- data/lib/ea/qea/models/ea_xref.rb +6 -7
- data/lib/ea/qea/repositories/base_repository.rb +1 -1
- data/lib/ea/qea/services/database_loader.rb +2 -4
- data/lib/ea/qea/validation/association_validator.rb +12 -12
- data/lib/ea/qea/validation/attribute_validator.rb +25 -26
- data/lib/ea/qea/validation/base_validator.rb +5 -5
- data/lib/ea/qea/validation/class_validator.rb +34 -34
- data/lib/ea/qea/validation/database/circular_reference_validator.rb +7 -7
- data/lib/ea/qea/validation/database/ocl_constraint_validator.rb +3 -3
- data/lib/ea/qea/validation/database/orphan_validator.rb +5 -7
- data/lib/ea/qea/validation/database/referential_integrity_validator.rb +39 -39
- data/lib/ea/qea/validation/diagram_validator.rb +39 -39
- data/lib/ea/qea/validation/formatters/json_formatter.rb +16 -16
- data/lib/ea/qea/validation/formatters/text_formatter.rb +10 -10
- data/lib/ea/qea/validation/operation_validator.rb +13 -14
- data/lib/ea/qea/validation/package_validator.rb +18 -18
- data/lib/ea/qea/validation/validation_engine.rb +5 -5
- data/lib/ea/qea/validation/validation_message.rb +56 -73
- data/lib/ea/qea/validation/validation_result.rb +6 -6
- data/lib/ea/qea/verification/comparison_result.rb +13 -21
- data/lib/ea/qea/verification/document_normalizer.rb +6 -12
- data/lib/ea/qea/verification/document_verifier.rb +39 -39
- data/lib/ea/qea/verification/element_comparator.rb +27 -31
- data/lib/ea/qea/verification/structure_matcher.rb +10 -10
- data/lib/ea/qea.rb +5 -7
- data/lib/ea/query/builder.rb +3 -3
- data/lib/ea/render/image_converter.rb +5 -3
- data/lib/ea/shapescript/parser.rb +4 -4
- data/lib/ea/sources/qea/classifier_builder.rb +7 -3
- data/lib/ea/sources/qea/context_diagram_support.rb +2 -2
- data/lib/ea/sources/qea/diagram_builder/routing.rb +4 -4
- data/lib/ea/sources/qea/diagram_builder.rb +80 -51
- data/lib/ea/sources/qea/id_normalizer.rb +0 -1
- data/lib/ea/sources/qea/instance_builder.rb +2 -2
- data/lib/ea/sources/qea/legend_builder.rb +1 -1
- data/lib/ea/sources/qea/note_builder.rb +4 -4
- data/lib/ea/sources/xmi/diagram_builder/stereotype_profiles.rb +1 -1
- data/lib/ea/sources/xmi/extension_style_parser.rb +2 -2
- data/lib/ea/sources/xmi/property_builder.rb +10 -2
- data/lib/ea/sources/xmi/relationship_builder.rb +10 -2
- data/lib/ea/sources/xmi/relationship_type_map.rb +1 -1
- data/lib/ea/sources/xmi/tag_builder.rb +1 -1
- data/lib/ea/sources/xmi/type_classifier_map.rb +1 -1
- data/lib/ea/spa/configuration.rb +2 -4
- data/lib/ea/spa/generator.rb +3 -3
- data/lib/ea/spa/output/strategy.rb +7 -5
- data/lib/ea/spa/projector.rb +21 -17
- data/lib/ea/svg/connector_router.rb +5 -3
- data/lib/ea/svg/ea_emitter/background.rb +0 -1
- data/lib/ea/svg/ea_emitter/bounds_calculator.rb +8 -10
- data/lib/ea/svg/ea_emitter/canvas.rb +1 -1
- data/lib/ea/svg/ea_emitter/color_resolver.rb +1 -1
- data/lib/ea/svg/ea_emitter/compartment/note_body.rb +1 -1
- data/lib/ea/svg/ea_emitter/connector_redock.rb +6 -3
- data/lib/ea/svg/ea_emitter/diagram_frame.rb +2 -2
- data/lib/ea/svg/ea_emitter/document.rb +1 -1
- data/lib/ea/svg/ea_emitter/element/attribute_renderer.rb +2 -4
- data/lib/ea/svg/ea_emitter/element/compartment_geometry.rb +18 -14
- data/lib/ea/svg/ea_emitter/element/header_line_pipeline.rb +6 -5
- data/lib/ea/svg/ea_emitter/element/header_line_provider/name.rb +1 -3
- data/lib/ea/svg/ea_emitter/element/header_line_provider/stereotype_label.rb +1 -1
- data/lib/ea/svg/ea_emitter/element/icon_renderer.rb +1 -1
- data/lib/ea/svg/ea_emitter/element/legend_renderer.rb +1 -1
- data/lib/ea/svg/ea_emitter/element/note_shape_renderer.rb +5 -5
- data/lib/ea/svg/ea_emitter/element/operation_renderer.rb +2 -3
- data/lib/ea/svg/ea_emitter/element/package_shape_renderer.rb +3 -4
- data/lib/ea/svg/ea_emitter/element/stereotype_icon_renderer.rb +1 -1
- data/lib/ea/svg/ea_emitter/elements.rb +64 -63
- data/lib/ea/svg/ea_emitter/ghost_labels.rb +0 -1
- data/lib/ea/svg/ea_emitter/label/end_label.rb +7 -7
- data/lib/ea/svg/ea_emitter/labels.rb +1 -1
- data/lib/ea/svg/ea_emitter/layer_sequencer.rb +5 -5
- data/lib/ea/svg/ea_emitter/marker/arrow_path.rb +4 -2
- data/lib/ea/svg/ea_emitter/marker/open_triangle.rb +4 -4
- data/lib/ea/svg/ea_emitter/markers.rb +3 -1
- data/lib/ea/svg/ea_emitter/render_context.rb +1 -1
- data/lib/ea/svg/ea_emitter/text_renderer.rb +15 -4
- data/lib/ea/theme/definition.rb +17 -17
- data/lib/ea/transformers/qea_to_xmi/context.rb +1 -1
- data/lib/ea/transformers/qea_to_xmi/run_state.rb +1 -1
- data/lib/ea/transformers/qea_to_xmi/transformer.rb +44 -44
- data/lib/ea/transformers/qea_to_xmi/visibility.rb +3 -3
- data/lib/ea/version.rb +1 -1
- data/lib/ea/xmi/liquid_drops/connector_drop.rb +2 -2
- data/lib/ea/xmi/liquid_drops/enum_drop.rb +4 -4
- data/lib/ea/xmi/liquid_drops/generalization_attribute_drop.rb +2 -8
- data/lib/ea/xmi/liquid_drops/generalization_drop.rb +3 -3
- data/lib/ea/xmi/liquid_drops/package_drop.rb +9 -9
- data/lib/ea/xmi/liquid_drops/root_drop.rb +1 -1
- data/lib/ea/xmi/loader.rb +5 -11
- data/lib/ea/xmi/parser.rb +75 -81
- data/lib/ea/xmi/slicer.rb +16 -12
- data/lib/ea/xref_format/legend_definition.rb +31 -0
- data/lib/ea/xref_format/parser.rb +146 -0
- data/lib/ea/xref_format/property_definition.rb +25 -0
- data/lib/ea/xref_format/record.rb +37 -0
- data/lib/ea/xref_format/stereotype_application.rb +33 -0
- data/lib/ea/xref_format.rb +36 -0
- data/lib/ea.rb +1 -0
- metadata +26 -25
- data/lib/ea/sources/qea/xref/legend_definition.rb +0 -35
- data/lib/ea/sources/qea/xref/parser.rb +0 -150
- data/lib/ea/sources/qea/xref/property_definition.rb +0 -29
- data/lib/ea/sources/qea/xref/record.rb +0 -41
- data/lib/ea/sources/qea/xref/stereotype_application.rb +0 -37
|
@@ -30,7 +30,7 @@ module Ea
|
|
|
30
30
|
@options = {
|
|
31
31
|
color: true,
|
|
32
32
|
verbose: false,
|
|
33
|
-
limit: nil
|
|
33
|
+
limit: nil
|
|
34
34
|
}.merge(options)
|
|
35
35
|
end
|
|
36
36
|
|
|
@@ -99,7 +99,7 @@ module Ea
|
|
|
99
99
|
"Messages:",
|
|
100
100
|
" Errors: #{colorize(result.errors.size.to_s, :red)}",
|
|
101
101
|
" Warnings: #{colorize(result.warnings.size.to_s, :yellow)}",
|
|
102
|
-
" Info: #{result.info.size}"
|
|
102
|
+
" Info: #{result.info.size}"
|
|
103
103
|
].join("\n")
|
|
104
104
|
end
|
|
105
105
|
|
|
@@ -141,7 +141,7 @@ module Ea
|
|
|
141
141
|
remaining = messages.size - options[:limit]
|
|
142
142
|
lines << colorize(
|
|
143
143
|
" ... and #{remaining} more (use --verbose to see all)",
|
|
144
|
-
:yellow
|
|
144
|
+
:yellow
|
|
145
145
|
)
|
|
146
146
|
end
|
|
147
147
|
|
|
@@ -163,7 +163,7 @@ module Ea
|
|
|
163
163
|
[
|
|
164
164
|
" #{icon} #{colorize(entity_info, :blue)}",
|
|
165
165
|
" #{message.message}",
|
|
166
|
-
" ID: #{message.entity_id}"
|
|
166
|
+
" ID: #{message.entity_id}"
|
|
167
167
|
].join("\n")
|
|
168
168
|
end
|
|
169
169
|
|
|
@@ -194,13 +194,13 @@ module Ea
|
|
|
194
194
|
|
|
195
195
|
# Returns an icon for the severity level
|
|
196
196
|
#
|
|
197
|
-
# @param severity [Symbol] Severity level
|
|
197
|
+
# @param severity [String, Symbol] Severity level
|
|
198
198
|
# @return [String]
|
|
199
199
|
def severity_icon(severity)
|
|
200
|
-
case severity
|
|
201
|
-
when
|
|
202
|
-
when
|
|
203
|
-
when
|
|
200
|
+
case severity.to_s
|
|
201
|
+
when "error" then colorize("✗", :red)
|
|
202
|
+
when "warning" then colorize("⚠", :yellow)
|
|
203
|
+
when "info" then colorize("ℹ", :blue)
|
|
204
204
|
else "•"
|
|
205
205
|
end
|
|
206
206
|
end
|
|
@@ -226,7 +226,7 @@ module Ea
|
|
|
226
226
|
else 0
|
|
227
227
|
end
|
|
228
228
|
|
|
229
|
-
"\e[#{codes.join(
|
|
229
|
+
"\e[#{codes.join(";")}m#{text}\e[0m"
|
|
230
230
|
end
|
|
231
231
|
end
|
|
232
232
|
end
|
|
@@ -14,18 +14,18 @@ module Ea
|
|
|
14
14
|
|
|
15
15
|
def validate_parent_object_references # rubocop:disable Metrics/MethodLength
|
|
16
16
|
operations.each do |op|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
17
|
+
next if reference_exists?("t_object", "ea_object_id",
|
|
18
|
+
op.ea_object_id)
|
|
19
|
+
|
|
20
|
+
result.add_error(
|
|
21
|
+
category: :missing_reference,
|
|
22
|
+
entity_type: :operation,
|
|
23
|
+
entity_id: op.operationid.to_s,
|
|
24
|
+
entity_name: op.name,
|
|
25
|
+
field: "ea_object_id",
|
|
26
|
+
reference: op.ea_object_id.to_s,
|
|
27
|
+
message: "Parent object #{op.ea_object_id} does not exist"
|
|
28
|
+
)
|
|
29
29
|
end
|
|
30
30
|
end
|
|
31
31
|
|
|
@@ -47,7 +47,7 @@ module Ea
|
|
|
47
47
|
entity_name: "#{parent&.name}.#{op.name}()",
|
|
48
48
|
field: "classifier",
|
|
49
49
|
reference: op.classifier,
|
|
50
|
-
message: "Return type '#{op.classifier}' not found"
|
|
50
|
+
message: "Return type '#{op.classifier}' not found"
|
|
51
51
|
)
|
|
52
52
|
end
|
|
53
53
|
end
|
|
@@ -64,7 +64,6 @@ module Ea
|
|
|
64
64
|
o.ea_object_id.to_s == classifier_id.to_s
|
|
65
65
|
end
|
|
66
66
|
end
|
|
67
|
-
|
|
68
67
|
end
|
|
69
68
|
end
|
|
70
69
|
end
|
|
@@ -13,23 +13,23 @@ module Ea
|
|
|
13
13
|
|
|
14
14
|
private
|
|
15
15
|
|
|
16
|
-
def validate_parent_references # rubocop:disable Metrics/
|
|
16
|
+
def validate_parent_references # rubocop:disable Metrics/MethodLength
|
|
17
17
|
packages.each do |package|
|
|
18
18
|
next if package.root?
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
20
|
+
next if parent_exists?(package.parent_id)
|
|
21
|
+
|
|
22
|
+
package_path = resolve_package_path(package.package_id)
|
|
23
|
+
result.add_error(
|
|
24
|
+
category: :missing_reference,
|
|
25
|
+
entity_type: :package,
|
|
26
|
+
entity_id: package.package_id.to_s,
|
|
27
|
+
entity_name: package.name,
|
|
28
|
+
field: "parent_id",
|
|
29
|
+
reference: package.parent_id.to_s,
|
|
30
|
+
message: "Parent package #{package.parent_id} does not exist",
|
|
31
|
+
location: package_path
|
|
32
|
+
)
|
|
33
33
|
end
|
|
34
34
|
end
|
|
35
35
|
|
|
@@ -57,14 +57,14 @@ module Ea
|
|
|
57
57
|
field: "name",
|
|
58
58
|
message: "Duplicate package name '#{dup_name}' " \
|
|
59
59
|
"in parent #{parent_path}",
|
|
60
|
-
location: package_path
|
|
60
|
+
location: package_path
|
|
61
61
|
)
|
|
62
62
|
end
|
|
63
63
|
end
|
|
64
64
|
end
|
|
65
65
|
end
|
|
66
66
|
|
|
67
|
-
def validate_circular_hierarchy # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength
|
|
67
|
+
def validate_circular_hierarchy # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength
|
|
68
68
|
packages.each do |package|
|
|
69
69
|
next if package.root?
|
|
70
70
|
|
|
@@ -81,8 +81,8 @@ module Ea
|
|
|
81
81
|
entity_name: package.name,
|
|
82
82
|
field: "parent_id",
|
|
83
83
|
message: "Circular package hierarchy detected: " \
|
|
84
|
-
"#{path.join(
|
|
85
|
-
location: package_path
|
|
84
|
+
"#{path.join(" -> ")} -> #{current_id}",
|
|
85
|
+
location: package_path
|
|
86
86
|
)
|
|
87
87
|
break
|
|
88
88
|
end
|
|
@@ -51,7 +51,7 @@ module Ea
|
|
|
51
51
|
# @param validators [Array<Symbol>, nil] List of validators to run,
|
|
52
52
|
# or nil to run all
|
|
53
53
|
# @return [ValidationResult]
|
|
54
|
-
def validate(validators: nil)
|
|
54
|
+
def validate(validators: nil)
|
|
55
55
|
result = ValidationResult.new
|
|
56
56
|
context = build_context
|
|
57
57
|
context[:result] = result
|
|
@@ -176,7 +176,7 @@ module Ea
|
|
|
176
176
|
context = {
|
|
177
177
|
document: @document,
|
|
178
178
|
database: @database,
|
|
179
|
-
options: @options
|
|
179
|
+
options: @options
|
|
180
180
|
}
|
|
181
181
|
|
|
182
182
|
# Extract entities from transformed document (preferred source)
|
|
@@ -277,7 +277,7 @@ module Ea
|
|
|
277
277
|
# @return [ValidationResult]
|
|
278
278
|
def filter_result(result)
|
|
279
279
|
return result unless @options[:min_severity] ||
|
|
280
|
-
|
|
280
|
+
@options[:categories]
|
|
281
281
|
|
|
282
282
|
filtered_result = ValidationResult.new
|
|
283
283
|
|
|
@@ -301,7 +301,7 @@ module Ea
|
|
|
301
301
|
severity_levels = {
|
|
302
302
|
info: 0,
|
|
303
303
|
warning: 1,
|
|
304
|
-
error: 2
|
|
304
|
+
error: 2
|
|
305
305
|
}
|
|
306
306
|
|
|
307
307
|
min_level = severity_levels[@options[:min_severity]] || 0
|
|
@@ -375,7 +375,7 @@ module Ea
|
|
|
375
375
|
# @return [void]
|
|
376
376
|
def display_messages_by_category(messages)
|
|
377
377
|
messages.group_by(&:category).each do |category, msgs|
|
|
378
|
-
puts " #{category.to_s.split(
|
|
378
|
+
puts " #{category.to_s.split("_").map(&:capitalize).join(" ")} " \
|
|
379
379
|
"(#{msgs.size}):"
|
|
380
380
|
msgs.each do |msg|
|
|
381
381
|
puts " #{msg}"
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require "lutaml/model"
|
|
4
|
+
|
|
3
5
|
module Ea
|
|
4
6
|
module Qea
|
|
5
7
|
module Validation
|
|
6
8
|
# Represents a single validation message with severity, category, and
|
|
7
|
-
# context information
|
|
9
|
+
# context information. Serialization (hash/JSON, with nil optional
|
|
10
|
+
# fields omitted) is declared through lutaml-model mappings.
|
|
8
11
|
#
|
|
9
12
|
# @example Creating an error message
|
|
10
13
|
# message = ValidationMessage.new(
|
|
@@ -18,64 +21,61 @@ module Ea
|
|
|
18
21
|
# message: "member_end references non-existent class",
|
|
19
22
|
# location: "Package::SubPackage"
|
|
20
23
|
# )
|
|
21
|
-
class ValidationMessage
|
|
22
|
-
# Severity levels for validation messages
|
|
24
|
+
class ValidationMessage < Lutaml::Model::Serializable
|
|
25
|
+
# Severity levels for validation messages (string tags; symbol
|
|
26
|
+
# inputs are normalized by the attribute cast)
|
|
23
27
|
module Severity
|
|
24
|
-
ERROR =
|
|
25
|
-
WARNING =
|
|
26
|
-
INFO =
|
|
28
|
+
ERROR = "error" # Breaks integrity, must fix
|
|
29
|
+
WARNING = "warning" # May cause issues, should review
|
|
30
|
+
INFO = "info" # Informational, may be intentional
|
|
27
31
|
end
|
|
28
32
|
|
|
29
33
|
# Categories of validation issues
|
|
30
34
|
module Category
|
|
31
|
-
MISSING_REFERENCE =
|
|
32
|
-
ORPHANED =
|
|
33
|
-
DUPLICATE =
|
|
34
|
-
INVALID_TYPE =
|
|
35
|
-
CIRCULAR_REFERENCE =
|
|
36
|
-
MISSING_REQUIRED =
|
|
37
|
-
CONSTRAINT_VIOLATION =
|
|
35
|
+
MISSING_REFERENCE = "missing_reference"
|
|
36
|
+
ORPHANED = "orphaned"
|
|
37
|
+
DUPLICATE = "duplicate"
|
|
38
|
+
INVALID_TYPE = "invalid_type"
|
|
39
|
+
CIRCULAR_REFERENCE = "circular_reference"
|
|
40
|
+
MISSING_REQUIRED = "missing_required"
|
|
41
|
+
CONSTRAINT_VIOLATION = "constraint_violation"
|
|
38
42
|
end
|
|
39
43
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
44
|
+
attribute :severity, :string
|
|
45
|
+
attribute :category, :string
|
|
46
|
+
attribute :entity_type, :string
|
|
47
|
+
attribute :entity_id, :string
|
|
48
|
+
attribute :entity_name, :string
|
|
49
|
+
attribute :field, :string
|
|
50
|
+
attribute :reference, :string
|
|
51
|
+
attribute :message, :string
|
|
52
|
+
attribute :location, :string
|
|
53
|
+
attribute :context, :hash, default: -> { {} }
|
|
43
54
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
severity
|
|
59
|
-
category
|
|
60
|
-
entity_type
|
|
61
|
-
entity_id
|
|
62
|
-
entity_name
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
location:
|
|
67
|
-
context:
|
|
68
|
-
)
|
|
69
|
-
@severity = severity
|
|
70
|
-
@category = category
|
|
71
|
-
@entity_type = entity_type
|
|
72
|
-
@entity_id = entity_id
|
|
73
|
-
@entity_name = entity_name
|
|
74
|
-
@field = field
|
|
75
|
-
@reference = reference
|
|
76
|
-
@message = message
|
|
77
|
-
@location = location
|
|
78
|
-
@context = context
|
|
55
|
+
json do
|
|
56
|
+
map "severity", to: :severity, render_nil: :omit
|
|
57
|
+
map "category", to: :category, render_nil: :omit
|
|
58
|
+
map "entity_type", to: :entity_type, render_nil: :omit
|
|
59
|
+
map "entity_id", to: :entity_id, render_nil: :omit
|
|
60
|
+
map "entity_name", to: :entity_name, render_nil: :omit
|
|
61
|
+
map "field", to: :field, render_nil: :omit
|
|
62
|
+
map "reference", to: :reference, render_nil: :omit
|
|
63
|
+
map "message", to: :message, render_nil: :omit
|
|
64
|
+
map "location", to: :location, render_nil: :omit
|
|
65
|
+
map "context", to: :context, render_nil: :omit
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
yaml do
|
|
69
|
+
map "severity", to: :severity, render_nil: :omit
|
|
70
|
+
map "category", to: :category, render_nil: :omit
|
|
71
|
+
map "entity_type", to: :entity_type, render_nil: :omit
|
|
72
|
+
map "entity_id", to: :entity_id, render_nil: :omit
|
|
73
|
+
map "entity_name", to: :entity_name, render_nil: :omit
|
|
74
|
+
map "field", to: :field, render_nil: :omit
|
|
75
|
+
map "reference", to: :reference, render_nil: :omit
|
|
76
|
+
map "message", to: :message, render_nil: :omit
|
|
77
|
+
map "location", to: :location, render_nil: :omit
|
|
78
|
+
map "context", to: :context, render_nil: :omit
|
|
79
79
|
end
|
|
80
80
|
|
|
81
81
|
# Checks if this is an error message
|
|
@@ -113,30 +113,13 @@ module Ea
|
|
|
113
113
|
parts.join("\n")
|
|
114
114
|
end
|
|
115
115
|
|
|
116
|
-
#
|
|
116
|
+
# Symbol-keyed view of the message. The canonical serialization
|
|
117
|
+
# (nil fields omitted) is the string-keyed framework output via
|
|
118
|
+
# #to_hash / #to_json.
|
|
117
119
|
#
|
|
118
120
|
# @return [Hash]
|
|
119
|
-
def to_h
|
|
120
|
-
|
|
121
|
-
severity: severity,
|
|
122
|
-
category: category,
|
|
123
|
-
entity_type: entity_type,
|
|
124
|
-
entity_id: entity_id,
|
|
125
|
-
entity_name: entity_name,
|
|
126
|
-
field: field,
|
|
127
|
-
reference: reference,
|
|
128
|
-
message: message,
|
|
129
|
-
location: location,
|
|
130
|
-
context: context,
|
|
131
|
-
}.compact
|
|
132
|
-
end
|
|
133
|
-
|
|
134
|
-
# Returns a JSON representation of the message
|
|
135
|
-
#
|
|
136
|
-
# @return [String]
|
|
137
|
-
def to_json(*)
|
|
138
|
-
require "json"
|
|
139
|
-
to_h.to_json(*)
|
|
121
|
+
def to_h
|
|
122
|
+
to_hash.transform_keys(&:to_sym)
|
|
140
123
|
end
|
|
141
124
|
end
|
|
142
125
|
end
|
|
@@ -111,7 +111,7 @@ module Ea
|
|
|
111
111
|
# @param severity [Symbol] The severity to filter by
|
|
112
112
|
# @return [Array<ValidationMessage>]
|
|
113
113
|
def by_severity(severity)
|
|
114
|
-
@messages.select { |m| m.severity == severity }
|
|
114
|
+
@messages.select { |m| m.severity == severity.to_s }
|
|
115
115
|
end
|
|
116
116
|
|
|
117
117
|
# Returns messages filtered by category
|
|
@@ -119,7 +119,7 @@ module Ea
|
|
|
119
119
|
# @param category [Symbol] The category to filter by
|
|
120
120
|
# @return [Array<ValidationMessage>]
|
|
121
121
|
def by_category(category)
|
|
122
|
-
@messages.select { |m| m.category == category }
|
|
122
|
+
@messages.select { |m| m.category == category.to_s }
|
|
123
123
|
end
|
|
124
124
|
|
|
125
125
|
# Returns messages filtered by entity type
|
|
@@ -127,7 +127,7 @@ module Ea
|
|
|
127
127
|
# @param entity_type [Symbol] The entity type to filter by
|
|
128
128
|
# @return [Array<ValidationMessage>]
|
|
129
129
|
def by_entity_type(entity_type)
|
|
130
|
-
@messages.select { |m| m.entity_type == entity_type }
|
|
130
|
+
@messages.select { |m| m.entity_type == entity_type.to_s }
|
|
131
131
|
end
|
|
132
132
|
|
|
133
133
|
# Returns messages grouped by category
|
|
@@ -161,7 +161,7 @@ module Ea
|
|
|
161
161
|
warnings: warnings.size,
|
|
162
162
|
info: info.size,
|
|
163
163
|
by_category: grouped_by_category.transform_values(&:size),
|
|
164
|
-
by_entity_type: grouped_by_entity_type.transform_values(&:size)
|
|
164
|
+
by_entity_type: grouped_by_entity_type.transform_values(&:size)
|
|
165
165
|
}
|
|
166
166
|
end
|
|
167
167
|
|
|
@@ -174,7 +174,7 @@ module Ea
|
|
|
174
174
|
"Total Messages: #{stats[:total]}",
|
|
175
175
|
"Errors: #{stats[:errors]}",
|
|
176
176
|
"Warnings: #{stats[:warnings]}",
|
|
177
|
-
"Info: #{stats[:info]}"
|
|
177
|
+
"Info: #{stats[:info]}"
|
|
178
178
|
].join("\n")
|
|
179
179
|
end
|
|
180
180
|
|
|
@@ -193,7 +193,7 @@ module Ea
|
|
|
193
193
|
def to_h
|
|
194
194
|
{
|
|
195
195
|
statistics: statistics,
|
|
196
|
-
messages: @messages.map(&:to_h)
|
|
196
|
+
messages: @messages.map(&:to_h)
|
|
197
197
|
}
|
|
198
198
|
end
|
|
199
199
|
|
|
@@ -16,7 +16,7 @@ module Ea
|
|
|
16
16
|
data_types: 0,
|
|
17
17
|
associations: 0,
|
|
18
18
|
attributes: 0,
|
|
19
|
-
operations: 0
|
|
19
|
+
operations: 0
|
|
20
20
|
}
|
|
21
21
|
@differences = []
|
|
22
22
|
@xmi_only = {
|
|
@@ -24,14 +24,14 @@ module Ea
|
|
|
24
24
|
classes: [],
|
|
25
25
|
enums: [],
|
|
26
26
|
data_types: [],
|
|
27
|
-
associations: []
|
|
27
|
+
associations: []
|
|
28
28
|
}
|
|
29
29
|
@qea_only = {
|
|
30
30
|
packages: [],
|
|
31
31
|
classes: [],
|
|
32
32
|
enums: [],
|
|
33
33
|
data_types: [],
|
|
34
|
-
associations: []
|
|
34
|
+
associations: []
|
|
35
35
|
}
|
|
36
36
|
@property_differences = []
|
|
37
37
|
end
|
|
@@ -76,7 +76,7 @@ module Ea
|
|
|
76
76
|
@property_differences << {
|
|
77
77
|
type: element_type,
|
|
78
78
|
name: element_name,
|
|
79
|
-
differences: differences
|
|
79
|
+
differences: differences
|
|
80
80
|
}
|
|
81
81
|
end
|
|
82
82
|
|
|
@@ -87,7 +87,7 @@ module Ea
|
|
|
87
87
|
def equivalent?
|
|
88
88
|
# No critical XMI-only elements (some are acceptable)
|
|
89
89
|
critical_xmi_only = xmi_only[:classes].any? ||
|
|
90
|
-
|
|
90
|
+
xmi_only[:packages].any?
|
|
91
91
|
|
|
92
92
|
# No property differences that indicate information loss
|
|
93
93
|
critical_property_diffs = property_differences.any? do |diff|
|
|
@@ -124,9 +124,7 @@ module Ea
|
|
|
124
124
|
elements.first(5).each do |elem|
|
|
125
125
|
lines << " - #{elem}"
|
|
126
126
|
end
|
|
127
|
-
if elements.size > 5
|
|
128
|
-
lines << " ... and #{elements.size - 5} more"
|
|
129
|
-
end
|
|
127
|
+
lines << " ... and #{elements.size - 5} more" if elements.size > 5
|
|
130
128
|
end
|
|
131
129
|
lines << ""
|
|
132
130
|
end
|
|
@@ -151,15 +149,13 @@ module Ea
|
|
|
151
149
|
lines << " - #{d}"
|
|
152
150
|
end
|
|
153
151
|
end
|
|
154
|
-
if property_differences.size > 10
|
|
155
|
-
lines << " ... and #{property_differences.size - 10} more"
|
|
156
|
-
end
|
|
152
|
+
lines << " ... and #{property_differences.size - 10} more" if property_differences.size > 10
|
|
157
153
|
lines << ""
|
|
158
154
|
end
|
|
159
155
|
|
|
160
156
|
# Result
|
|
161
157
|
lines << "Result: " \
|
|
162
|
-
"#{equivalent? ?
|
|
158
|
+
"#{equivalent? ? "✓ EQUIVALENT" : "✗ NOT EQUIVALENT"}"
|
|
163
159
|
lines << ""
|
|
164
160
|
|
|
165
161
|
lines << if equivalent?
|
|
@@ -182,7 +178,7 @@ module Ea
|
|
|
182
178
|
xmi_only: xmi_only,
|
|
183
179
|
qea_only: qea_only,
|
|
184
180
|
property_differences: property_differences,
|
|
185
|
-
summary: summary
|
|
181
|
+
summary: summary
|
|
186
182
|
}
|
|
187
183
|
end
|
|
188
184
|
|
|
@@ -195,7 +191,7 @@ module Ea
|
|
|
195
191
|
total_xmi_only: xmi_only.values.sum(&:size),
|
|
196
192
|
total_qea_only: qea_only.values.sum(&:size),
|
|
197
193
|
total_property_diffs: property_differences.size,
|
|
198
|
-
equivalent: equivalent
|
|
194
|
+
equivalent: equivalent?
|
|
199
195
|
}
|
|
200
196
|
end
|
|
201
197
|
|
|
@@ -209,18 +205,14 @@ module Ea
|
|
|
209
205
|
# Get critical issues (information loss)
|
|
210
206
|
#
|
|
211
207
|
# @return [Array<String>] List of critical issues
|
|
212
|
-
def critical_issues # rubocop:disable Metrics/AbcSize
|
|
208
|
+
def critical_issues # rubocop:disable Metrics/AbcSize
|
|
213
209
|
issues = []
|
|
214
210
|
|
|
215
211
|
# Missing packages
|
|
216
|
-
if xmi_only[:packages].any?
|
|
217
|
-
issues << "Missing #{xmi_only[:packages].size} packages in QEA"
|
|
218
|
-
end
|
|
212
|
+
issues << "Missing #{xmi_only[:packages].size} packages in QEA" if xmi_only[:packages].any?
|
|
219
213
|
|
|
220
214
|
# Missing classes
|
|
221
|
-
if xmi_only[:classes].any?
|
|
222
|
-
issues << "Missing #{xmi_only[:classes].size} classes in QEA"
|
|
223
|
-
end
|
|
215
|
+
issues << "Missing #{xmi_only[:classes].size} classes in QEA" if xmi_only[:classes].any?
|
|
224
216
|
|
|
225
217
|
# Property differences with information loss
|
|
226
218
|
property_differences.each do |diff|
|
|
@@ -21,7 +21,7 @@ module Ea
|
|
|
21
21
|
#
|
|
22
22
|
# @param document [Lutaml::Uml::Document] The document to process
|
|
23
23
|
# @return [void]
|
|
24
|
-
def remove_xmi_ids(document)
|
|
24
|
+
def remove_xmi_ids(document)
|
|
25
25
|
# Remove XMI IDs from packages recursively
|
|
26
26
|
process_packages(document.packages) if document.packages
|
|
27
27
|
|
|
@@ -71,7 +71,7 @@ module Ea
|
|
|
71
71
|
private
|
|
72
72
|
|
|
73
73
|
# Process packages recursively to remove XMI IDs
|
|
74
|
-
def process_packages(packages)
|
|
74
|
+
def process_packages(packages)
|
|
75
75
|
packages.each do |package|
|
|
76
76
|
package.xmi_id = nil
|
|
77
77
|
process_classes(package.classes) if package.classes
|
|
@@ -100,9 +100,7 @@ module Ea
|
|
|
100
100
|
end
|
|
101
101
|
|
|
102
102
|
# Process nested classes
|
|
103
|
-
if klass.is_a?(Lutaml::Uml::Package) && klass.classes
|
|
104
|
-
process_classes(klass.classes)
|
|
105
|
-
end
|
|
103
|
+
process_classes(klass.classes) if klass.is_a?(Lutaml::Uml::Package) && klass.classes
|
|
106
104
|
end
|
|
107
105
|
end
|
|
108
106
|
|
|
@@ -110,12 +108,8 @@ module Ea
|
|
|
110
108
|
def process_associations(associations)
|
|
111
109
|
associations.each do |assoc|
|
|
112
110
|
assoc.xmi_id = nil
|
|
113
|
-
if assoc.owner_end_xmi_id
|
|
114
|
-
|
|
115
|
-
end
|
|
116
|
-
if assoc.member_end_xmi_id
|
|
117
|
-
assoc.member_end_xmi_id = nil
|
|
118
|
-
end
|
|
111
|
+
assoc.owner_end_xmi_id = nil if assoc.owner_end_xmi_id
|
|
112
|
+
assoc.member_end_xmi_id = nil if assoc.member_end_xmi_id
|
|
119
113
|
end
|
|
120
114
|
end
|
|
121
115
|
|
|
@@ -147,7 +141,7 @@ module Ea
|
|
|
147
141
|
end
|
|
148
142
|
|
|
149
143
|
# Sort collections within classes
|
|
150
|
-
def sort_class_collections(classes)
|
|
144
|
+
def sort_class_collections(classes)
|
|
151
145
|
classes.each do |klass|
|
|
152
146
|
klass.attributes&.sort_by! { |a| a.name || "" }
|
|
153
147
|
klass.operations&.sort_by! { |o| o.name || "" }
|