lutaml 0.10.4 → 0.10.5

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.
Files changed (116) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +10 -0
  3. data/.rubocop_todo.yml +91 -101
  4. data/TODO.cleanups/01-resolve-production-todos.md +65 -0
  5. data/TODO.cleanups/02-reduce-metrics-offenses.md +37 -0
  6. data/TODO.cleanups/03-reduce-rspec-multiple-expectations.md +54 -0
  7. data/TODO.cleanups/04-reduce-rspec-example-length.md +45 -0
  8. data/TODO.cleanups/05-replace-marshal-load.md +37 -0
  9. data/TODO.cleanups/06-replace-eval-in-tests.md +41 -0
  10. data/TODO.cleanups/07-fix-lint-offenses.md +74 -0
  11. data/TODO.cleanups/08-reduce-memoized-helpers-and-nesting.md +43 -0
  12. data/TODO.cleanups/09-reduce-verified-doubles-and-rspec-style.md +57 -0
  13. data/TODO.cleanups/10-split-large-files.md +47 -0
  14. data/bin/console +0 -1
  15. data/lib/lutaml/cli/element_identifier.rb +3 -6
  16. data/lib/lutaml/cli/interactive_shell/bookmark_commands.rb +88 -0
  17. data/lib/lutaml/cli/interactive_shell/command_base.rb +28 -0
  18. data/lib/lutaml/cli/interactive_shell/export_handler.rb +67 -0
  19. data/lib/lutaml/cli/interactive_shell/help_display.rb +114 -0
  20. data/lib/lutaml/cli/interactive_shell/navigation_commands.rb +135 -0
  21. data/lib/lutaml/cli/interactive_shell/query_commands.rb +185 -0
  22. data/lib/lutaml/cli/interactive_shell.rb +116 -802
  23. data/lib/lutaml/cli/uml/build_command.rb +5 -5
  24. data/lib/lutaml/cli/uml/verify_command.rb +0 -1
  25. data/lib/lutaml/converter/xmi_to_uml.rb +3 -153
  26. data/lib/lutaml/converter/xmi_to_uml_generalization.rb +193 -0
  27. data/lib/lutaml/formatter/graphviz.rb +1 -2
  28. data/lib/lutaml/qea/database.rb +1 -47
  29. data/lib/lutaml/qea/factory/association_builder.rb +187 -0
  30. data/lib/lutaml/qea/factory/base_transformer.rb +0 -1
  31. data/lib/lutaml/qea/factory/class_transformer.rb +42 -594
  32. data/lib/lutaml/qea/factory/diagram_transformer.rb +0 -3
  33. data/lib/lutaml/qea/factory/generalization_builder.rb +211 -0
  34. data/lib/lutaml/qea/factory/package_transformer.rb +1 -2
  35. data/lib/lutaml/qea/factory/stereotype_loader.rb +34 -0
  36. data/lib/lutaml/qea/lookup_indexes.rb +54 -0
  37. data/lib/lutaml/qea/models/ea_datatype.rb +0 -2
  38. data/lib/lutaml/qea/validation/validation_engine.rb +0 -2
  39. data/lib/lutaml/uml/has_members.rb +0 -1
  40. data/lib/lutaml/uml/inheritance_walker.rb +91 -0
  41. data/lib/lutaml/uml/model_helpers.rb +129 -0
  42. data/lib/lutaml/uml/node/attribute.rb +3 -1
  43. data/lib/lutaml/uml/node/class_node.rb +3 -3
  44. data/lib/lutaml/uml/operation.rb +2 -0
  45. data/lib/lutaml/uml_repository/class_lookup_index.rb +40 -0
  46. data/lib/lutaml/uml_repository/exporters/markdown/class_page_builder.rb +177 -0
  47. data/lib/lutaml/uml_repository/exporters/markdown/formatting.rb +36 -0
  48. data/lib/lutaml/uml_repository/exporters/markdown/index_page_builder.rb +73 -0
  49. data/lib/lutaml/uml_repository/exporters/markdown/link_resolver.rb +40 -0
  50. data/lib/lutaml/uml_repository/exporters/markdown/package_page_builder.rb +107 -0
  51. data/lib/lutaml/uml_repository/exporters/markdown_exporter.rb +25 -538
  52. data/lib/lutaml/uml_repository/index_builder.rb +3 -271
  53. data/lib/lutaml/uml_repository/index_builders/association_index.rb +141 -0
  54. data/lib/lutaml/uml_repository/index_builders/class_index.rb +94 -0
  55. data/lib/lutaml/uml_repository/index_builders/package_index.rb +57 -0
  56. data/lib/lutaml/uml_repository/package_exporter.rb +10 -20
  57. data/lib/lutaml/uml_repository/package_loader.rb +37 -17
  58. data/lib/lutaml/uml_repository/repository/deprecated.rb +39 -0
  59. data/lib/lutaml/uml_repository/repository/loader.rb +112 -0
  60. data/lib/lutaml/uml_repository/repository.rb +6 -57
  61. data/lib/lutaml/uml_repository/static_site/association_serialization.rb +142 -0
  62. data/lib/lutaml/uml_repository/static_site/configuration.rb +0 -2
  63. data/lib/lutaml/uml_repository/static_site/data_transformer.rb +41 -878
  64. data/lib/lutaml/uml_repository/static_site/search_index_builder.rb +1 -4
  65. data/lib/lutaml/uml_repository/static_site/serializers/attribute_serializer.rb +78 -0
  66. data/lib/lutaml/uml_repository/static_site/serializers/class_serializer.rb +119 -0
  67. data/lib/lutaml/uml_repository/static_site/serializers/diagram_serializer.rb +59 -0
  68. data/lib/lutaml/uml_repository/static_site/serializers/inheritance_resolver.rb +250 -0
  69. data/lib/lutaml/uml_repository/static_site/serializers/metadata_builder.rb +48 -0
  70. data/lib/lutaml/uml_repository/static_site/serializers/operation_serializer.rb +57 -0
  71. data/lib/lutaml/uml_repository/static_site/serializers/package_serializer.rb +87 -0
  72. data/lib/lutaml/uml_repository/static_site/serializers/package_tree_builder.rb +89 -0
  73. data/lib/lutaml/version.rb +1 -1
  74. data/lib/lutaml/xmi/liquid_drops/association_drop.rb +13 -35
  75. data/lib/lutaml/xmi/liquid_drops/attribute_drop.rb +12 -18
  76. data/lib/lutaml/xmi/liquid_drops/cardinality_drop.rb +14 -6
  77. data/lib/lutaml/xmi/liquid_drops/connector_drop.rb +0 -3
  78. data/lib/lutaml/xmi/liquid_drops/constraint_drop.rb +1 -3
  79. data/lib/lutaml/xmi/liquid_drops/data_type_drop.rb +13 -70
  80. data/lib/lutaml/xmi/liquid_drops/dependency_drop.rb +2 -5
  81. data/lib/lutaml/xmi/liquid_drops/diagram_drop.rb +5 -11
  82. data/lib/lutaml/xmi/liquid_drops/enum_drop.rb +8 -16
  83. data/lib/lutaml/xmi/liquid_drops/enum_owned_literal_drop.rb +3 -9
  84. data/lib/lutaml/xmi/liquid_drops/generalization_attribute_drop.rb +11 -13
  85. data/lib/lutaml/xmi/liquid_drops/generalization_drop.rb +27 -85
  86. data/lib/lutaml/xmi/liquid_drops/klass_drop.rb +39 -91
  87. data/lib/lutaml/xmi/liquid_drops/operation_drop.rb +3 -9
  88. data/lib/lutaml/xmi/liquid_drops/package_drop.rb +16 -44
  89. data/lib/lutaml/xmi/liquid_drops/root_drop.rb +3 -11
  90. data/lib/lutaml/xmi/liquid_drops/source_target_drop.rb +2 -5
  91. data/lib/lutaml/xmi/parsers/xmi_base.rb +2 -749
  92. data/lib/lutaml/xmi/parsers/xmi_class_members.rb +45 -0
  93. data/lib/lutaml/xmi/parsers/xmi_connector.rb +251 -0
  94. data/lib/lutaml/xmi/parsers/xml.rb +7 -120
  95. data/lib/lutaml/xmi/xmi_lookup_service.rb +42 -0
  96. data/lib/lutaml.rb +0 -1
  97. metadata +48 -21
  98. data/lib/lutaml/cli/commands/base_command.rb +0 -118
  99. data/lib/lutaml/command_line.rb +0 -272
  100. data/lib/lutaml/sysml/allocate.rb +0 -9
  101. data/lib/lutaml/sysml/allocated.rb +0 -9
  102. data/lib/lutaml/sysml/binding_connector.rb +0 -9
  103. data/lib/lutaml/sysml/block.rb +0 -32
  104. data/lib/lutaml/sysml/constraint_block.rb +0 -14
  105. data/lib/lutaml/sysml/copy.rb +0 -8
  106. data/lib/lutaml/sysml/derive_requirement.rb +0 -9
  107. data/lib/lutaml/sysml/nested_connector_end.rb +0 -13
  108. data/lib/lutaml/sysml/refine.rb +0 -9
  109. data/lib/lutaml/sysml/requirement.rb +0 -44
  110. data/lib/lutaml/sysml/requirement_related.rb +0 -9
  111. data/lib/lutaml/sysml/satisfy.rb +0 -9
  112. data/lib/lutaml/sysml/test_case.rb +0 -25
  113. data/lib/lutaml/sysml/trace.rb +0 -9
  114. data/lib/lutaml/sysml/verify.rb +0 -8
  115. data/lib/lutaml/sysml/xmi_file.rb +0 -486
  116. data/lib/lutaml/sysml.rb +0 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9db8def51fe994ba67b18e3e2045df78ebc06fab52a471fb95e7421738e10dcc
4
- data.tar.gz: 1ba2c6caed21e4a4b35b4a117f39327312505ebe2b72f389db3561f568395577
3
+ metadata.gz: 2d1caee886e1e27cbbd7db3101f510bd0a1169050cbab47f48bdb31622e46c16
4
+ data.tar.gz: 4d42b151859f65339b67dffc2e5070e2851819daaf145295b05285d2cecc5e50
5
5
  SHA512:
6
- metadata.gz: 9a529f0ab5096212dc808a5cd21ca2eba20cbc8f1bc940076398755302af766462e66e3984d33ef9349d0510c0d25aa845af4b8b7046b6cdc93317d2d21aba5d
7
- data.tar.gz: e26992d6162b77054ef39f915d4633a213452a98b6e0057ae4240ad825d7f008f529024ba91b3dfbd7dc77ac40a02e4ee3c01cbbdeabcbe3e77c2d5898ebe468
6
+ metadata.gz: 62f845a38a4336cee141fb710ced850a20332db561ab44fe08d16c9e780c75c2844b982176902c0eab600175561e7efd7b63136ba9eabc707ce07d424f1c0c9f
7
+ data.tar.gz: 0ce0fd5ae74fdd0ba9f795e39e4b7b0ead7492443f06eeee34dbbeaaf31fdab16601174dbf53f72d412c13581a8cac82cefdf4906c060f317d7f7afd2a8f3b1d
data/.rubocop.yml CHANGED
@@ -17,3 +17,13 @@ plugins:
17
17
 
18
18
  AllCops:
19
19
  TargetRubyVersion: 3.2
20
+
21
+ # VerifiedDoubles is disabled because many spec files use double() to mock
22
+ # UML model classes (Lutaml::Uml::Class, Package, etc.) that don't implement
23
+ # all stubbed methods as real Ruby methods (they use Lutaml::Model::Serializable
24
+ # attribute declarations). Converting to instance_double would cause test failures
25
+ # due to method verification.
26
+ RSpec/VerifiedDoubles:
27
+ Enabled: false
28
+ Exclude:
29
+ - 'spec/**/*'
data/.rubocop_todo.yml CHANGED
@@ -1,32 +1,52 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2026-04-25 02:05:14 UTC using RuboCop version 1.86.1.
3
+ # on 2026-04-28 10:51:28 UTC using RuboCop version 1.86.1.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 1
9
+ # Offense count: 16
10
10
  # This cop supports safe autocorrection (--autocorrect).
11
- Layout/ElseAlignment:
11
+ Layout/EmptyLineAfterGuardClause:
12
12
  Exclude:
13
- - 'lib/lutaml/qea/factory/class_transformer.rb'
13
+ - 'lib/lutaml/qea/factory/association_builder.rb'
14
+ - 'lib/lutaml/uml/inheritance_walker.rb'
15
+ - 'lib/lutaml/uml_repository/static_site/data_transformer.rb'
16
+ - 'lib/lutaml/uml_repository/static_site/serializers/class_serializer.rb'
17
+ - 'lib/lutaml/uml_repository/static_site/serializers/diagram_serializer.rb'
18
+ - 'lib/lutaml/uml_repository/static_site/serializers/inheritance_resolver.rb'
19
+ - 'lib/lutaml/uml_repository/static_site/serializers/package_serializer.rb'
20
+
21
+ # Offense count: 4
22
+ # This cop supports safe autocorrection (--autocorrect).
23
+ # Configuration parameters: EmptyLineBetweenMethodDefs, EmptyLineBetweenClassDefs, EmptyLineBetweenModuleDefs, DefLikeMacros, AllowAdjacentOneLineDefs, NumberOfEmptyLines.
24
+ Layout/EmptyLineBetweenDefs:
25
+ Exclude:
26
+ - 'lib/lutaml/cli/interactive_shell/command_base.rb'
14
27
 
15
28
  # Offense count: 1
16
29
  # This cop supports safe autocorrection (--autocorrect).
17
- # Configuration parameters: Width, EnforcedStyleAlignWith, AllowedPatterns.
18
- # SupportedStylesAlignWith: start_of_line, relative_to_receiver
19
- Layout/IndentationWidth:
30
+ Layout/EmptyLinesAfterModuleInclusion:
20
31
  Exclude:
21
- - 'lib/lutaml/qea/factory/class_transformer.rb'
32
+ - 'lib/lutaml/uml_repository/repository.rb'
22
33
 
23
- # Offense count: 80
34
+ # Offense count: 183
24
35
  # This cop supports safe autocorrection (--autocorrect).
25
36
  # Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings.
26
37
  # URISchemes: http, https
27
38
  Layout/LineLength:
28
39
  Enabled: false
29
40
 
41
+ # Offense count: 2
42
+ # This cop supports safe autocorrection (--autocorrect).
43
+ # Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
44
+ # SupportedStyles: space, no_space, compact
45
+ # SupportedStylesForEmptyBraces: space, no_space
46
+ Layout/SpaceInsideHashLiteralBraces:
47
+ Exclude:
48
+ - 'lib/lutaml/uml/model_helpers.rb'
49
+
30
50
  # Offense count: 1
31
51
  Lint/BinaryOperatorWithIdenticalOperands:
32
52
  Exclude:
@@ -43,23 +63,12 @@ Lint/ConstantDefinitionInBlock:
43
63
  - 'spec/lutaml/model_transformations_spec.rb'
44
64
  - 'spec/lutaml/uml_repository/presenters/presenter_factory_spec.rb'
45
65
 
46
- # Offense count: 1
47
- Lint/CopDirectiveSyntax:
48
- Exclude:
49
- - 'lib/lutaml/uml_repository/repository.rb'
50
-
51
- # Offense count: 8
66
+ # Offense count: 2
52
67
  # Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches, IgnoreDuplicateElseBranch.
53
68
  Lint/DuplicateBranch:
54
69
  Exclude:
55
- - 'lib/lutaml/cli/element_identifier.rb'
56
- - 'lib/lutaml/cli/uml/verify_command.rb'
57
- - 'lib/lutaml/qea/factory/base_transformer.rb'
58
- - 'lib/lutaml/qea/models/ea_datatype.rb'
59
- - 'lib/lutaml/qea/validation/validation_engine.rb'
70
+ - 'lib/lutaml/uml/model_helpers.rb'
60
71
  - 'lib/lutaml/uml_repository/queries/package_query.rb'
61
- - 'lib/lutaml/uml_repository/static_site/configuration.rb'
62
- - 'lib/lutaml/uml_repository/static_site/search_index_builder.rb'
63
72
 
64
73
  # Offense count: 4
65
74
  # Configuration parameters: AllowComments, AllowEmptyLambdas.
@@ -89,6 +98,13 @@ Lint/MissingSuper:
89
98
  Exclude:
90
99
  - 'lib/lutaml/uml_repository/lazy_repository.rb'
91
100
 
101
+ # Offense count: 2
102
+ # This cop supports safe autocorrection (--autocorrect).
103
+ Lint/RedundantRequireStatement:
104
+ Exclude:
105
+ - 'lib/lutaml/qea/factory/generalization_builder.rb'
106
+ - 'lib/lutaml/uml_repository/static_site/serializers/inheritance_resolver.rb'
107
+
92
108
  # Offense count: 1
93
109
  # This cop supports safe autocorrection (--autocorrect).
94
110
  # Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods, NotImplementedExceptions.
@@ -97,62 +113,45 @@ Lint/UnusedMethodArgument:
97
113
  Exclude:
98
114
  - 'lib/lutaml/cli/uml/export_command.rb'
99
115
 
100
- # Offense count: 8
116
+ # Offense count: 2
117
+ Lint/UselessConstantScoping:
118
+ Exclude:
119
+ - 'lib/lutaml/cli/interactive_shell.rb'
120
+
121
+ # Offense count: 52
101
122
  # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max.
102
123
  Metrics/AbcSize:
103
- Exclude:
104
- - 'lib/lutaml/converter/xmi_to_uml.rb'
105
- - 'lib/lutaml/model_transformations/parsers/base_parser.rb'
106
- - 'lib/lutaml/qea/database.rb'
107
- - 'lib/lutaml/uml_repository/index_builder.rb'
108
- - 'lib/lutaml/uml_repository/queries/class_query.rb'
109
- - 'lib/lutaml/uml_repository/queries/inheritance_query.rb'
110
- - 'lib/lutaml/xmi/parsers/xmi_base.rb'
124
+ Enabled: false
111
125
 
112
- # Offense count: 1
126
+ # Offense count: 4
113
127
  # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns, inherit_mode.
114
128
  # AllowedMethods: refine
115
129
  Metrics/BlockLength:
116
- Max: 28
130
+ Max: 53
117
131
 
118
- # Offense count: 11
132
+ # Offense count: 37
119
133
  # Configuration parameters: AllowedMethods, AllowedPatterns, Max.
120
134
  Metrics/CyclomaticComplexity:
121
- Exclude:
122
- - 'lib/lutaml/cli/tree_view_formatter.rb'
123
- - 'lib/lutaml/converter/xmi_to_uml.rb'
124
- - 'lib/lutaml/qea/database.rb'
125
- - 'lib/lutaml/qea/factory/enum_transformer.rb'
126
- - 'lib/lutaml/uml_repository/index_builder.rb'
127
- - 'lib/lutaml/uml_repository/queries/class_query.rb'
128
- - 'lib/lutaml/uml_repository/queries/inheritance_query.rb'
129
- - 'lib/lutaml/uml_repository/queries/search_query.rb'
130
- - 'lib/lutaml/xmi/parsers/xmi_base.rb'
135
+ Enabled: false
131
136
 
132
- # Offense count: 11
137
+ # Offense count: 65
133
138
  # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
134
139
  Metrics/MethodLength:
135
- Max: 27
140
+ Max: 62
136
141
 
137
- # Offense count: 8
142
+ # Offense count: 29
138
143
  # Configuration parameters: AllowedMethods, AllowedPatterns, Max.
139
144
  Metrics/PerceivedComplexity:
140
- Exclude:
141
- - 'lib/lutaml/converter/xmi_to_uml.rb'
142
- - 'lib/lutaml/qea/database.rb'
143
- - 'lib/lutaml/qea/factory/enum_transformer.rb'
144
- - 'lib/lutaml/uml_repository/index_builder.rb'
145
- - 'lib/lutaml/uml_repository/queries/class_query.rb'
146
- - 'lib/lutaml/uml_repository/queries/inheritance_query.rb'
147
- - 'lib/lutaml/xmi/parsers/xmi_base.rb'
145
+ Enabled: false
148
146
 
149
- # Offense count: 2
147
+ # Offense count: 3
150
148
  # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
151
149
  # AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to
152
150
  Naming/MethodParameterName:
153
151
  Exclude:
154
152
  - 'lib/lutaml/cli/tree_view_formatter.rb'
155
153
  - 'lib/lutaml/uml_repository/static_site/generator.rb'
154
+ - 'spec/lutaml/parsers/serialize_xmi_to_liquid_spec.rb'
156
155
 
157
156
  # Offense count: 1
158
157
  # Configuration parameters: Mode, AllowedMethods, AllowedPatterns, AllowBangMethods, WaywardPredicates.
@@ -162,14 +161,13 @@ Naming/PredicateMethod:
162
161
  Exclude:
163
162
  - 'lib/lutaml/qea/factory/document_builder.rb'
164
163
 
165
- # Offense count: 5
164
+ # Offense count: 3
166
165
  # Configuration parameters: MinSize.
167
166
  Performance/CollectionLiteralInLoop:
168
167
  Exclude:
169
- - 'lib/lutaml/xmi/parsers/xmi_base.rb'
168
+ - 'lib/lutaml/xmi/parsers/xmi_connector.rb'
170
169
  - 'spec/lutaml/qea/infrastructure/table_reader_spec.rb'
171
170
  - 'spec/lutaml/uml_repository/index_builder_spec.rb'
172
- - 'spec/lutaml/uml_repository/queries/inheritance_query_spec.rb'
173
171
 
174
172
  # Offense count: 2
175
173
  Performance/MapMethodChain:
@@ -211,10 +209,10 @@ RSpec/ContextWording:
211
209
  RSpec/DescribeClass:
212
210
  Enabled: false
213
211
 
214
- # Offense count: 657
212
+ # Offense count: 649
215
213
  # Configuration parameters: CountAsOne.
216
214
  RSpec/ExampleLength:
217
- Max: 108
215
+ Max: 30
218
216
 
219
217
  # Offense count: 7
220
218
  # This cop supports safe autocorrection (--autocorrect).
@@ -241,20 +239,6 @@ RSpec/IndexedLet:
241
239
  - 'spec/lutaml/qea/repositories/base_repository_spec.rb'
242
240
  - 'spec/lutaml/qea/repositories/object_repository_spec.rb'
243
241
 
244
- # Offense count: 48
245
- # Configuration parameters: AssignmentOnly.
246
- RSpec/InstanceVariable:
247
- Exclude:
248
- - 'spec/lutaml/parsers/parse_xmi_spec.rb'
249
- - 'spec/lutaml/qea/verification/comprehensive_equivalence_spec.rb'
250
-
251
- # Offense count: 2
252
- # This cop supports safe autocorrection (--autocorrect).
253
- RSpec/IteratedExpectation:
254
- Exclude:
255
- - 'spec/lutaml/ea/diagram/layout_engine_spec.rb'
256
- - 'spec/lutaml/uml_repository/queries/inheritance_query_spec.rb'
257
-
258
242
  # Offense count: 15
259
243
  RSpec/LeakyConstantDeclaration:
260
244
  Exclude:
@@ -279,19 +263,19 @@ RSpec/MessageSpies:
279
263
  - 'spec/lutaml/uml_repository/presenters/diagram_presenter_spec.rb'
280
264
  - 'spec/lutaml/uml_repository/repository_spec.rb'
281
265
 
282
- # Offense count: 946
266
+ # Offense count: 35
283
267
  RSpec/MultipleExpectations:
284
- Max: 26
268
+ Max: 6
285
269
 
286
- # Offense count: 130
270
+ # Offense count: 151
287
271
  # Configuration parameters: AllowSubject.
288
272
  RSpec/MultipleMemoizedHelpers:
289
273
  Max: 11
290
274
 
291
- # Offense count: 29
275
+ # Offense count: 35
292
276
  # Configuration parameters: AllowedGroups.
293
277
  RSpec/NestedGroups:
294
- Max: 5
278
+ Max: 4
295
279
 
296
280
  # Offense count: 2
297
281
  # Configuration parameters: AllowedPatterns.
@@ -301,13 +285,12 @@ RSpec/NoExpectationExample:
301
285
  - 'spec/lutaml/qea/verification/comprehensive_equivalence_spec.rb'
302
286
  - 'spec/lutaml/uml_repository/static_site/generator_spec.rb'
303
287
 
304
- # Offense count: 16
288
+ # Offense count: 12
305
289
  RSpec/RepeatedExample:
306
290
  Exclude:
307
291
  - 'spec/lutaml/cli/package_commands_spec.rb'
308
292
  - 'spec/lutaml/ea/diagram/svg_renderer_spec.rb'
309
293
  - 'spec/lutaml/qea/validation/validation_engine_spec.rb'
310
- - 'spec/lutaml/uml_repository/presenters/diagram_presenter_spec.rb'
311
294
  - 'spec/lutaml/uml_repository/static_site/data_transformer_spec.rb'
312
295
 
313
296
  # Offense count: 2
@@ -315,7 +298,7 @@ RSpec/RepeatedExampleGroupDescription:
315
298
  Exclude:
316
299
  - 'spec/lutaml/uml/parsers/dsl_spec.rb'
317
300
 
318
- # Offense count: 6
301
+ # Offense count: 5
319
302
  # Configuration parameters: CustomTransform, IgnoreMethods, IgnoreMetadata, InflectorPath, EnforcedInflector.
320
303
  # SupportedInflectors: default, active_support
321
304
  RSpec/SpecFilePathFormat:
@@ -323,34 +306,18 @@ RSpec/SpecFilePathFormat:
323
306
  - 'spec/express/parsers/exp_spec.rb'
324
307
  - 'spec/lutaml/parser_qea_spec.rb'
325
308
  - 'spec/lutaml/parsers/parse_xmi_spec.rb'
326
- - 'spec/lutaml/parsers/serialize_generalization_by_name_spec.rb'
327
309
  - 'spec/lutaml/parsers/serialize_xmi_to_liquid_spec.rb'
328
310
  - 'spec/lutaml/uml_repository/web_ui/app_spec.rb'
329
311
 
330
- # Offense count: 6
331
- RSpec/UnspecifiedException:
332
- Exclude:
333
- - 'spec/lutaml/model_transformations/parsers/qea_parser_spec.rb'
334
- - 'spec/lutaml/model_transformations/parsers/xmi_parser_spec.rb'
335
- - 'spec/lutaml/model_transformations_spec.rb'
336
- - 'spec/lutaml/parser_qea_spec.rb'
337
- - 'spec/lutaml/qea/integration/full_parsing_spec.rb'
338
-
339
- # Offense count: 212
340
- # Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
341
- RSpec/VerifiedDoubles:
342
- Enabled: false
343
-
344
312
  # Offense count: 3
345
313
  Security/Eval:
346
314
  Exclude:
347
315
  - 'spec/lutaml/cli/uml/search_command_spec.rb'
348
316
 
349
- # Offense count: 4
317
+ # Offense count: 2
350
318
  Security/MarshalLoad:
351
319
  Exclude:
352
320
  - 'lib/lutaml/uml_repository/package_loader.rb'
353
- - 'spec/lutaml/uml_repository/package_exporter_spec.rb'
354
321
 
355
322
  # Offense count: 2
356
323
  # This cop supports safe autocorrection (--autocorrect).
@@ -369,11 +336,18 @@ Style/EvalWithLocation:
369
336
  Exclude:
370
337
  - 'spec/lutaml/cli/uml/search_command_spec.rb'
371
338
 
339
+ # Offense count: 1
340
+ # This cop supports safe autocorrection (--autocorrect).
341
+ # Configuration parameters: AllowMethodComparison, ComparisonsThreshold.
342
+ Style/MultipleComparison:
343
+ Exclude:
344
+ - 'lib/lutaml/cli/interactive_shell.rb'
345
+
372
346
  # Offense count: 1
373
347
  # This cop supports unsafe autocorrection (--autocorrect-all).
374
348
  Style/PartitionInsteadOfDoubleSelect:
375
349
  Exclude:
376
- - 'lib/lutaml/qea/factory/class_transformer.rb'
350
+ - 'lib/lutaml/qea/factory/generalization_builder.rb'
377
351
 
378
352
  # Offense count: 3
379
353
  # Configuration parameters: Max.
@@ -381,3 +355,19 @@ Style/SafeNavigationChainLength:
381
355
  Exclude:
382
356
  - 'lib/lutaml/qea/validation/attribute_validator.rb'
383
357
  - 'lib/lutaml/qea/validation/operation_validator.rb'
358
+
359
+ # Offense count: 1
360
+ # This cop supports safe autocorrection (--autocorrect).
361
+ # Configuration parameters: EnforcedStyleForMultiline.
362
+ # SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma
363
+ Style/TrailingCommaInArguments:
364
+ Exclude:
365
+ - 'lib/lutaml/qea/factory/class_transformer.rb'
366
+
367
+ # Offense count: 2
368
+ # This cop supports safe autocorrection (--autocorrect).
369
+ # Configuration parameters: EnforcedStyleForMultiline.
370
+ # SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma
371
+ Style/TrailingCommaInHashLiteral:
372
+ Exclude:
373
+ - 'lib/lutaml/cli/interactive_shell.rb'
@@ -0,0 +1,65 @@
1
+ # 01 — Resolve 7 production TODOs
2
+
3
+ ## Problem
4
+
5
+ Seven `TODO`/`FIXME` comments in `lib/` represent incomplete features, missing validation, or known tech debt. They risk silent data loss or incorrect behavior.
6
+
7
+ ## Items
8
+
9
+ ### 1. `lib/lutaml/qea/factory/diagram_transformer.rb:28`
10
+ ```ruby
11
+ # TODO: Fix diagram_type assignment -
12
+ # lutaml-model compatibility issue
13
+ # diagram.diagram_type = ea_diagram.diagram_type
14
+ ```
15
+ **Impact**: Diagram type is silently dropped during QEA→UML transformation. The `diagram_type` attribute exists on `Lutaml::Uml::Diagram` but is never populated from QEA.
16
+ **Fix**: Investigate lutaml-model compatibility (likely a type mismatch or missing attribute). Either fix the assignment or document why it's intentionally omitted.
17
+
18
+ ### 2. `lib/lutaml/qea/factory/package_transformer.rb:32`
19
+ ```ruby
20
+ # TODO: Fix tagged_values assignment - temporarily commented out
21
+ # pkg.tagged_values = load_tagged_values(ea_package.ea_guid)
22
+ ```
23
+ **Impact**: Tagged values (metadata/annotations) are silently dropped from packages during QEA→UML transformation. This causes XMI/QEA equivalence mismatches.
24
+ **Fix**: Check if `load_tagged_values` returns correct type. Likely needs the same serialization pattern used in class_transformer.
25
+
26
+ ### 3. `lib/lutaml/formatter/graphviz.rb:56`
27
+ ```ruby
28
+ # TODO: set rankdir
29
+ # @graph['rankdir'] = 'BT'
30
+ ```
31
+ **Impact**: Graph direction can't be configured. The value is commented out.
32
+ **Fix**: Either expose as configurable option or remove dead code.
33
+
34
+ ### 4. `lib/lutaml/uml/node/class_node.rb:19`
35
+ ```ruby
36
+ @modifier = value.to_s # TODO: Validate?
37
+ ```
38
+ **Impact**: No validation on modifier values — invalid strings accepted silently.
39
+ **Fix**: Add enum validation for known modifiers (`public`, `private`, `protected`, etc.) or remove the TODO if validation isn't needed.
40
+
41
+ ### 5. `lib/lutaml/uml/node/attribute.rb:27`
42
+ ```ruby
43
+ @access = value.to_s # TODO: Validate?
44
+ ```
45
+ **Impact**: Same as #4 but for access modifiers on attributes.
46
+ **Fix**: Same as #4 — validate or remove TODO.
47
+
48
+ ### 6. `lib/lutaml/uml/node/class_node.rb:24`
49
+ ```ruby
50
+ type = member.to_a[0][0] # TODO: This is dumb
51
+ ```
52
+ **Impact**: Fragile parsing of member data structure. The `TODO: This is dumb` indicates the developer knew it was wrong but shipped it.
53
+ **Fix**: Replace with structured member parsing using named access.
54
+
55
+ ### 7. `lib/lutaml/uml/has_members.rb:8`
56
+ ```ruby
57
+ # TODO: move to Parslet::Transform
58
+ ```
59
+ **Impact**: Member type logic is in the model instead of the parser layer.
60
+ **Fix**: Evaluate whether moving to Parslet::Transform is still desirable. If not, remove the TODO.
61
+
62
+ ## Verification
63
+
64
+ - `grep -rn "TODO\|FIXME" lib/ --include="*.rb"` should return 0 results (or only intentional ones)
65
+ - Full test suite passes: `bundle exec rspec`
@@ -0,0 +1,37 @@
1
+ # 02 — Reduce Metrics/AbcSize and method complexity (212 + 130 + 11 + 11 + 8 offenses)
2
+
3
+ ## Problem
4
+
5
+ 5 Metrics cops account for **372 offenses** across production code. The worst offenders are large methods that do too much, making them hard to test, debug, and maintain.
6
+
7
+ ## Top targets by file
8
+
9
+ | File | AbcSize | MethodLength | Cyclomatic | Perceived | Lines |
10
+ |------|---------|-------------|------------|-----------|-------|
11
+ | `lib/lutaml/xmi/parsers/xmi_base.rb` | Yes | — | Yes | Yes | 1047 |
12
+ | `lib/lutaml/converter/xmi_to_uml.rb` | Yes | — | Yes | Yes | 474 |
13
+ | `lib/lutaml/uml_repository/index_builder.rb` | Yes | — | Yes | Yes | 480 |
14
+ | `lib/lutaml/qea/database.rb` | Yes | — | Yes | Yes | 477 |
15
+ | `lib/lutaml/uml_repository/queries/class_query.rb` | Yes | — | Yes | Yes | 151 |
16
+ | `lib/lutaml/uml_repository/queries/inheritance_query.rb` | Yes | — | Yes | Yes | — |
17
+ | `lib/lutaml/model_transformations/parsers/base_parser.rb` | Yes | — | — | — | — |
18
+ | `lib/lutaml/qea/factory/enum_transformer.rb` | — | — | Yes | Yes | — |
19
+ | `lib/lutaml/uml_repository/queries/search_query.rb` | — | — | Yes | — | — |
20
+ | `lib/lutaml/cli/tree_view_formatter.rb` | — | — | Yes | — | — |
21
+
22
+ ## Approach
23
+
24
+ Extract helper methods from god methods. Common patterns:
25
+
26
+ 1. **xmi_base.rb** — The 1047-line file has massive parsing methods. Extract per-element-type parsing into separate methods (already partially done).
27
+ 2. **converter/xmi_to_uml.rb** — The `build_*` methods handle too many concerns. Extract mapping logic per element type.
28
+ 3. **index_builder.rb** — The single-pass `build_all` is better than before but individual index builders can be further split.
29
+ 4. **database.rb** — The `build_lookup_indexes` method builds all indexes at once; split into per-index methods.
30
+
31
+ **Do NOT**: Increase Max thresholds in `.rubocop_todo.yml`. Instead, refactor to reduce actual complexity.
32
+
33
+ ## Verification
34
+
35
+ - `bundle exec rubocop --only Metrics` shows reduced offense counts
36
+ - `bundle exec rspec` passes
37
+ - No functional changes — pure refactoring
@@ -0,0 +1,54 @@
1
+ # 03 — Reduce RSpec/MultipleExpectations (946 offenses)
2
+
3
+ ## Problem
4
+
5
+ 946 test examples have more than 1 expectation. This is the single largest rubocop offense. It makes tests brittle (failures stop at the first failed expectation, masking other issues) and harder to understand what's being verified.
6
+
7
+ ## Approach
8
+
9
+ Split multi-expectation examples into focused single-expectation examples:
10
+
11
+ ```ruby
12
+ # BEFORE:
13
+ it "validates the widget" do
14
+ expect(widget.name).to eq("Test")
15
+ expect(widget.size).to eq(10)
16
+ expect(widget.active).to be true
17
+ end
18
+
19
+ # AFTER:
20
+ it { expect(widget.name).to eq("Test") }
21
+ it { expect(widget.size).to eq(10) }
22
+ it { expect(widget.active).to be true }
23
+ ```
24
+
25
+ For cases where multiple expectations are genuinely related (e.g., checking a hash structure), use compound matchers:
26
+
27
+ ```ruby
28
+ expect(result).to include("name" => "Test", "size" => 10, "active" => true)
29
+ ```
30
+
31
+ Or aggregate failures with `aggregate_failures` when the expectations are about the same concern:
32
+
33
+ ```ruby
34
+ it "has correct address fields" do
35
+ aggregate_failures do
36
+ expect(address.street).to eq("Main St")
37
+ expect(address.city).to eq("London")
38
+ end
39
+ end
40
+ ```
41
+
42
+ ## Priority files (highest offense density)
43
+
44
+ Run `bundle exec rubocop --only RSpec/MultipleExpectations` to see the full list. Focus on:
45
+ 1. `spec/lutaml/qea/verification/comprehensive_equivalence_spec.rb`
46
+ 2. `spec/lutaml/qea/verification/equivalence_integration_spec.rb`
47
+ 3. `spec/lutaml/cli/` command specs
48
+ 4. `spec/lutaml/uml_repository/` specs
49
+
50
+ ## Verification
51
+
52
+ - `bundle exec rubocop --only RSpec/MultipleExpectations` shows reduced count
53
+ - `bundle exec rspec` passes
54
+ - Reduce Max from 26 toward 5 (default)
@@ -0,0 +1,45 @@
1
+ # 04 — Reduce RSpec/ExampleLength (657 offenses)
2
+
3
+ ## Problem
4
+
5
+ 657 test examples exceed the default 5-line limit (current Max: 108). Long examples are hard to read, hide intent, and often combine setup + action + multiple assertions.
6
+
7
+ ## Approach
8
+
9
+ Common patterns to fix:
10
+
11
+ 1. **Extract test data into `let`/`let!`** — Move setup out of `it` blocks:
12
+ ```ruby
13
+ # BEFORE:
14
+ it "parses correctly" do
15
+ result = described_class.parse(fixture_content)
16
+ expect(result.name).to eq("Test")
17
+ end
18
+
19
+ # AFTER:
20
+ let(:result) { described_class.parse(fixture_content) }
21
+ it { expect(result.name).to eq("Test") }
22
+ ```
23
+
24
+ 2. **Extract shared setup into `before` blocks** — If multiple examples repeat the same setup.
25
+
26
+ 3. **Use subject with one-liner syntax** — Where the subject is the tested value:
27
+ ```ruby
28
+ subject { described_class.new(attrs) }
29
+ it { is_expected.to be_valid }
30
+ ```
31
+
32
+ 4. **Extract helper methods** — Complex assertions that span many lines can become custom matchers or helper methods in `spec/support/`.
33
+
34
+ ## Priority
35
+
36
+ Focus on the longest examples first — run `bundle exec rubocop --only RSpec/ExampleLength` and sort by severity. Files with the worst examples:
37
+ - `spec/lutaml/qea/` verification and factory specs
38
+ - `spec/lutaml/uml_repository/` static site specs
39
+ - `spec/lutaml/cli/` command specs
40
+
41
+ ## Verification
42
+
43
+ - `bundle exec rubocop --only RSpec/ExampleLength` shows reduced count
44
+ - Reduce Max from 108 toward 10
45
+ - `bundle exec rspec` passes
@@ -0,0 +1,37 @@
1
+ # 05 — Replace Marshal.load with safe deserialization (4 offenses)
2
+
3
+ ## Problem
4
+
5
+ `Marshal.load` is flagged by `Security/MarshalLoad` because deserializing untrusted data can lead to remote code execution. The gem uses it in the `.lur` package format (a ZIP file containing serialized Ruby objects).
6
+
7
+ ## Affected files
8
+
9
+ ```ruby
10
+ # lib/lutaml/uml_repository/package_loader.rb:194
11
+ Marshal.load(entry.get_input_stream.read)
12
+
13
+ # lib/lutaml/uml_repository/package_loader.rb:210
14
+ Marshal.load(entry.get_input_stream.read)
15
+
16
+ # spec/lutaml/uml_repository/package_exporter_spec.rb:141
17
+ expect { Marshal.load(serialized) }.not_to raise_error
18
+
19
+ # spec/lutaml/uml_repository/package_exporter_spec.rb:171
20
+ expect { Marshal.load(serialized) }.not_to raise_error
21
+ ```
22
+
23
+ ## Approach
24
+
25
+ **Option A: Switch to JSON serialization** — Replace `Marshal.dump`/`Marshal.load` with `JSON.generate`/`JSON.parse` in `PackageExporter` and `PackageLoader`. This is safe but requires models to be JSON-serializable.
26
+
27
+ **Option B: Use YAML with permitted classes** — `YAML.safe_load` with an explicit allowlist of classes. More flexible but still requires maintaining the class list.
28
+
29
+ **Option C: Keep Marshal but document the trust boundary** — If `.lur` files are only ever created by the gem itself (trusted), the risk is mitigated. Add a clear comment at the load site and suppress the cop with justification.
30
+
31
+ **Recommended**: Option A if feasible (cleanest), Option C as a minimal fix.
32
+
33
+ ## Verification
34
+
35
+ - `bundle exec rubocop --only Security/MarshalLoad` shows 0 offenses
36
+ - `.lur` package round-trip (export → load) works correctly
37
+ - `bundle exec rspec` passes
@@ -0,0 +1,41 @@
1
+ # 06 — Replace eval in tests with StringIO redirection (3 Security/Eval + 2 Style/EvalWithLocation + 2 Style/DocumentDynamicEvalDefinition)
2
+
3
+ ## Problem
4
+
5
+ `spec/lutaml/cli/uml/search_command_spec.rb` uses `eval` to redirect `$stdout`/`$stderr` for capturing output. This triggers 7 rubocop offenses across Security and Style cops.
6
+
7
+ ## Affected code
8
+
9
+ ```ruby
10
+ # spec/lutaml/cli/uml/search_command_spec.rb:61-65
11
+ old_stream = eval(stream_var.to_s)
12
+ eval("#{stream_var} = StringIO.new")
13
+ # ...
14
+ eval("#{stream_var} = old_stream") if defined?(old_stream) && old_stream
15
+ ```
16
+
17
+ ## Fix
18
+
19
+ Replace with a standard output capture pattern:
20
+
21
+ ```ruby
22
+ # Use RSpec's built-in output matcher:
23
+ expect { command.run }.to output(/expected text/).to_stdout
24
+
25
+ # Or use a capture helper:
26
+ def capture_output
27
+ old_stdout = $stdout
28
+ $stdout = StringIO.new
29
+ yield
30
+ $stdout.string
31
+ ensure
32
+ $stdout = old_stdout
33
+ end
34
+ ```
35
+
36
+ No `eval` needed — just use `$stdout` directly instead of dynamically resolving the variable name.
37
+
38
+ ## Verification
39
+
40
+ - `bundle exec rubocop --only Security/Eval,Style/EvalWithLocation,Style/DocumentDynamicEvalDefinition` shows 0 offenses
41
+ - `bundle exec rspec spec/lutaml/cli/uml/search_command_spec.rb` passes