lutaml 0.10.14 → 0.10.17

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 (55) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop_todo.yml +19 -118
  3. data/CLAUDE.md +38 -0
  4. data/lib/lutaml/cli/interactive_shell/export_handler.rb +16 -10
  5. data/lib/lutaml/cli/interactive_shell/help_display.rb +37 -35
  6. data/lib/lutaml/cli/interactive_shell/navigation_commands.rb +11 -7
  7. data/lib/lutaml/cli/interactive_shell/query_commands.rb +11 -1
  8. data/lib/lutaml/cli/interactive_shell.rb +11 -3
  9. data/lib/lutaml/cli/tree_view_formatter.rb +11 -3
  10. data/lib/lutaml/cli/uml/build_command.rb +152 -218
  11. data/lib/lutaml/cli/uml/diagram_command.rb +242 -258
  12. data/lib/lutaml/converter/xmi_to_uml.rb +11 -6
  13. data/lib/lutaml/formatter/graphviz.rb +80 -46
  14. data/lib/lutaml/model_transformations/parsers/base_parser.rb +27 -29
  15. data/lib/lutaml/qea/database.rb +76 -287
  16. data/lib/lutaml/qea/factory/association_builder.rb +50 -22
  17. data/lib/lutaml/qea/factory/class_transformer.rb +24 -10
  18. data/lib/lutaml/qea/factory/ea_to_uml_factory.rb +11 -22
  19. data/lib/lutaml/qea/factory/enum_transformer.rb +20 -9
  20. data/lib/lutaml/qea/factory/generalization_builder.rb +12 -12
  21. data/lib/lutaml/qea/lookup_indexes.rb +23 -12
  22. data/lib/lutaml/uml/inheritance_walker.rb +11 -7
  23. data/lib/lutaml/uml/model_helpers.rb +21 -0
  24. data/lib/lutaml/uml_repository/exporters/markdown/index_page_builder.rb +17 -9
  25. data/lib/lutaml/uml_repository/exporters/markdown_exporter.rb +27 -20
  26. data/lib/lutaml/uml_repository/index_builders/association_index.rb +21 -11
  27. data/lib/lutaml/uml_repository/index_builders/class_index.rb +5 -1
  28. data/lib/lutaml/uml_repository/package_loader.rb +5 -2
  29. data/lib/lutaml/uml_repository/presenters/enum_presenter.rb +1 -1
  30. data/lib/lutaml/uml_repository/queries/class_query.rb +15 -10
  31. data/lib/lutaml/uml_repository/queries/search_query.rb +122 -277
  32. data/lib/lutaml/uml_repository/query_dsl/conditions/package_condition.rb +9 -2
  33. data/lib/lutaml/uml_repository/repository/loader.rb +14 -7
  34. data/lib/lutaml/uml_repository/repository.rb +21 -35
  35. data/lib/lutaml/uml_repository/repository_enhanced.rb +15 -27
  36. data/lib/lutaml/uml_repository/static_site/association_serialization.rb +11 -23
  37. data/lib/lutaml/uml_repository/static_site/data_transformer.rb +14 -19
  38. data/lib/lutaml/uml_repository/static_site/generator.rb +20 -36
  39. data/lib/lutaml/uml_repository/static_site/serializers/attribute_serializer.rb +0 -14
  40. data/lib/lutaml/uml_repository/static_site/serializers/class_serializer.rb +19 -27
  41. data/lib/lutaml/uml_repository/static_site/serializers/inheritance_resolver.rb +75 -81
  42. data/lib/lutaml/uml_repository/static_site/serializers/package_serializer.rb +15 -25
  43. data/lib/lutaml/uml_repository/static_site/serializers/package_tree_builder.rb +7 -2
  44. data/lib/lutaml/uml_repository/validators/repository_validator.rb +36 -51
  45. data/lib/lutaml/version.rb +1 -1
  46. data/lib/lutaml/xmi/liquid_drops/klass_drop.rb +49 -31
  47. data/lib/lutaml/xmi/parsers/xmi_connector.rb +35 -23
  48. metadata +3 -9
  49. data/TODO.cleanups/01-resolve-production-todos.md +0 -65
  50. data/TODO.cleanups/02-reduce-metrics-offenses.md +0 -37
  51. data/TODO.cleanups/03-reduce-rspec-multiple-expectations.md +0 -54
  52. data/TODO.cleanups/04-reduce-rspec-example-length.md +0 -45
  53. data/TODO.cleanups/07-fix-lint-offenses.md +0 -74
  54. data/TODO.cleanups/08-reduce-memoized-helpers-and-nesting.md +0 -43
  55. data/TODO.cleanups/09-reduce-verified-doubles-and-rspec-style.md +0 -57
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 69670b20b9f7eeb39ebc7fc3fa638b7f2934d077e18319af972881c3ef0522b5
4
- data.tar.gz: b77ad5274ea62236961489bfef7751d7f4ca98ddcc8e4daa5cff30469d00abd8
3
+ metadata.gz: 330cf6a6d4021d51bfb8ee166e4f6dce5697ed5fff82cdc6043a6d304d7e853d
4
+ data.tar.gz: 4bd730f3e5a2ae0427d2157bb862788ddd516280d86b9f791ec3e46473710dac
5
5
  SHA512:
6
- metadata.gz: d75318da9968bee531f257272a490b574c7541a264ce54283f35bea1cd4cc24314d9766ab8da589a326ea06edb7ac953b43c4c2db3579cc55dee46f0bee22f25
7
- data.tar.gz: 9ab593c061dfb0983ded7744859ddf3e7214dc8e64f5808dae4f54f779bab4a772b6c5af65eb5c69d1df887b2ae52837d69e872790656e9aa444cd0f91eb77e0
6
+ metadata.gz: b1cf1135be7d630644fbf782c1070231a54c0c3341b8c1be7c688a4d3c29d2aa34c26ef900f056c8d50f9c10b674e0470d46646de49b5386de51896e45a79ee3
7
+ data.tar.gz: 5b716ba1f4bd818a81f7fd54567add05c1ed0682fb407379db5d086fc8c636586e5a162480b821a23be4977d31ebe986be61531851faad122ddf0c74785bd59c
data/.rubocop_todo.yml CHANGED
@@ -1,47 +1,21 @@
1
1
  # This configuration was generated by
2
- # `rubocop --auto-gen-config`
3
- # on 2026-05-12 14:40:16 UTC using RuboCop version 1.86.1.
2
+ # `rubocop --auto-gen-config --no-offense-counts`
3
+ # on 2026-05-13 08:26:11 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: 6
10
- # This cop supports safe autocorrection (--autocorrect).
11
- # Configuration parameters: EnforcedStyle, IndentationWidth.
12
- # SupportedStyles: with_first_argument, with_fixed_indentation
13
- Layout/ArgumentAlignment:
14
- Exclude:
15
- - 'lib/lutaml/qea/factory/association_builder.rb'
16
- - 'lib/lutaml/qea/factory/generalization_builder.rb'
17
- - 'lib/lutaml/uml_repository/index_builders/class_index.rb'
18
- - 'lib/lutaml/uml_repository/static_site/serializers/class_serializer.rb'
19
- - 'lib/lutaml/uml_repository/static_site/serializers/inheritance_resolver.rb'
20
-
21
- # Offense count: 158
22
9
  # This cop supports safe autocorrection (--autocorrect).
23
10
  # Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings.
24
11
  # URISchemes: http, https
25
12
  Layout/LineLength:
26
13
  Enabled: false
27
14
 
28
- # Offense count: 7
29
- # This cop supports safe autocorrection (--autocorrect).
30
- # Configuration parameters: AllowInHeredoc.
31
- Layout/TrailingWhitespace:
32
- Exclude:
33
- - 'lib/lutaml/qea/factory/generalization_builder.rb'
34
- - 'lib/lutaml/uml_repository/index_builders/class_index.rb'
35
- - 'lib/lutaml/uml_repository/queries/inheritance_query.rb'
36
- - 'lib/lutaml/uml_repository/static_site/serializers/class_serializer.rb'
37
- - 'lib/lutaml/uml_repository/static_site/serializers/inheritance_resolver.rb'
38
-
39
- # Offense count: 1
40
15
  Lint/BinaryOperatorWithIdenticalOperands:
41
16
  Exclude:
42
17
  - 'spec/lutaml/qea/lookup_tables_spec.rb'
43
18
 
44
- # Offense count: 15
45
19
  # Configuration parameters: AllowedMethods.
46
20
  # AllowedMethods: enums
47
21
  Lint/ConstantDefinitionInBlock:
@@ -52,14 +26,12 @@ Lint/ConstantDefinitionInBlock:
52
26
  - 'spec/lutaml/model_transformations_spec.rb'
53
27
  - 'spec/lutaml/uml_repository/presenters/presenter_factory_spec.rb'
54
28
 
55
- # Offense count: 2
56
29
  # Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches, IgnoreDuplicateElseBranch.
57
30
  Lint/DuplicateBranch:
58
31
  Exclude:
59
32
  - 'lib/lutaml/uml/model_helpers.rb'
60
33
  - 'lib/lutaml/uml_repository/queries/package_query.rb'
61
34
 
62
- # Offense count: 4
63
35
  # Configuration parameters: AllowComments, AllowEmptyLambdas.
64
36
  Lint/EmptyBlock:
65
37
  Exclude:
@@ -68,7 +40,6 @@ Lint/EmptyBlock:
68
40
  - 'spec/lutaml/uml_repository/package_exporter_spec.rb'
69
41
  - 'spec/lutaml/uml_repository/repository_spec.rb'
70
42
 
71
- # Offense count: 3
72
43
  # This cop supports safe autocorrection (--autocorrect).
73
44
  # Configuration parameters: AllowComments.
74
45
  Lint/EmptyConditionalBody:
@@ -76,18 +47,15 @@ Lint/EmptyConditionalBody:
76
47
  - 'spec/integration/qea_xmi_equivalency_spec.rb'
77
48
  - 'spec/lutaml/qea/verification/equivalence_integration_spec.rb'
78
49
 
79
- # Offense count: 4
80
50
  Lint/IneffectiveAccessModifier:
81
51
  Exclude:
82
52
  - 'lib/lutaml/uml_repository/repository_enhanced.rb'
83
53
 
84
- # Offense count: 1
85
54
  # Configuration parameters: AllowedParentClasses.
86
55
  Lint/MissingSuper:
87
56
  Exclude:
88
57
  - 'lib/lutaml/uml_repository/lazy_repository.rb'
89
58
 
90
- # Offense count: 1
91
59
  # This cop supports safe autocorrection (--autocorrect).
92
60
  # Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods, NotImplementedExceptions.
93
61
  # NotImplementedExceptions: NotImplementedError
@@ -95,48 +63,46 @@ Lint/UnusedMethodArgument:
95
63
  Exclude:
96
64
  - 'lib/lutaml/cli/uml/export_command.rb'
97
65
 
98
- # Offense count: 2
99
66
  Lint/UselessConstantScoping:
100
67
  Exclude:
101
68
  - 'lib/lutaml/cli/interactive_shell.rb'
69
+ - 'lib/lutaml/cli/uml/diagram_command.rb'
70
+ - 'lib/lutaml/qea/factory/ea_to_uml_factory.rb'
71
+ - 'lib/lutaml/uml_repository/static_site/generator.rb'
72
+ - 'lib/lutaml/uml_repository/static_site/serializers/inheritance_resolver.rb'
102
73
 
103
- # Offense count: 33
104
74
  # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max.
105
75
  Metrics/AbcSize:
106
- Enabled: false
76
+ Exclude:
77
+ - 'lib/lutaml/cli/interactive_shell/query_commands.rb'
78
+ - 'lib/lutaml/cli/uml/diagram_command.rb'
79
+ - 'lib/lutaml/qea/factory/generalization_builder.rb'
80
+ - 'lib/lutaml/uml_repository/exporters/markdown/class_page_builder.rb'
81
+ - 'lib/lutaml/uml_repository/queries/search_query.rb'
82
+ - 'lib/lutaml/uml_repository/static_site/serializers/class_serializer.rb'
107
83
 
108
- # Offense count: 23
109
84
  # Configuration parameters: AllowedMethods, AllowedPatterns, Max.
110
85
  Metrics/CyclomaticComplexity:
111
- Enabled: false
86
+ Exclude:
87
+ - 'lib/lutaml/qea/factory/generalization_builder.rb'
88
+ - 'lib/lutaml/uml_repository/index_builders/association_index.rb'
89
+ - 'lib/lutaml/uml_repository/queries/search_query.rb'
90
+ - 'lib/lutaml/uml_repository/static_site/serializers/class_serializer.rb'
112
91
 
113
- # Offense count: 63
114
92
  # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
115
93
  Metrics/MethodLength:
116
- Max: 21
94
+ Max: 17
117
95
 
118
- # Offense count: 2
119
96
  # Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
120
97
  Metrics/ParameterLists:
121
98
  Max: 7
122
99
 
123
- # Offense count: 12
124
100
  # Configuration parameters: AllowedMethods, AllowedPatterns, Max.
125
101
  Metrics/PerceivedComplexity:
126
102
  Exclude:
127
- - 'lib/lutaml/cli/interactive_shell/navigation_commands.rb'
128
- - 'lib/lutaml/converter/xmi_to_uml.rb'
129
- - 'lib/lutaml/qea/factory/association_builder.rb'
130
103
  - 'lib/lutaml/qea/factory/ea_to_uml_factory.rb'
131
- - 'lib/lutaml/qea/lookup_indexes.rb'
132
- - 'lib/lutaml/uml_repository/index_builders/association_index.rb'
133
- - 'lib/lutaml/uml_repository/repository/loader.rb'
134
- - 'lib/lutaml/uml_repository/static_site/data_transformer.rb'
135
104
  - 'lib/lutaml/uml_repository/static_site/serializers/class_serializer.rb'
136
- - 'lib/lutaml/uml_repository/static_site/serializers/inheritance_resolver.rb'
137
- - 'lib/lutaml/xmi/parsers/xmi_connector.rb'
138
105
 
139
- # Offense count: 3
140
106
  # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
141
107
  # AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to
142
108
  Naming/MethodParameterName:
@@ -145,7 +111,6 @@ Naming/MethodParameterName:
145
111
  - 'lib/lutaml/uml_repository/static_site/generator.rb'
146
112
  - 'spec/lutaml/parsers/serialize_xmi_to_liquid_spec.rb'
147
113
 
148
- # Offense count: 3
149
114
  # Configuration parameters: Mode, AllowedMethods, AllowedPatterns, AllowBangMethods, WaywardPredicates.
150
115
  # AllowedMethods: call
151
116
  # WaywardPredicates: infinite?, nonzero?
@@ -154,31 +119,25 @@ Naming/PredicateMethod:
154
119
  - 'lib/lutaml/qea/factory/document_builder.rb'
155
120
  - 'spec/lutaml/xmi/liquid_drops/nil_safety_spec.rb'
156
121
 
157
- # Offense count: 3
158
122
  # Configuration parameters: MinSize.
159
123
  Performance/CollectionLiteralInLoop:
160
124
  Exclude:
161
- - 'lib/lutaml/xmi/parsers/xmi_connector.rb'
162
125
  - 'spec/lutaml/qea/infrastructure/table_reader_spec.rb'
163
126
  - 'spec/lutaml/uml_repository/index_builder_spec.rb'
164
127
 
165
- # Offense count: 2
166
128
  Performance/MapMethodChain:
167
129
  Exclude:
168
130
  - 'lib/lutaml/cli/output_formatter.rb'
169
131
  - 'lib/lutaml/qea/models/ea_diagram_link.rb'
170
132
 
171
- # Offense count: 5
172
133
  RSpec/AnyInstance:
173
134
  Exclude:
174
135
  - 'spec/lutaml/uml_repository/static_site/generator_spec.rb'
175
136
 
176
- # Offense count: 1
177
137
  RSpec/BeforeAfterAll:
178
138
  Exclude:
179
139
  - 'spec/lutaml/qea/verification/comprehensive_equivalence_spec.rb'
180
140
 
181
- # Offense count: 24
182
141
  # Configuration parameters: Prefixes, AllowedPatterns.
183
142
  # Prefixes: when, with, without
184
143
  RSpec/ContextWording:
@@ -196,42 +155,35 @@ RSpec/ContextWording:
196
155
  - 'spec/lutaml/qea/integration/full_parsing_spec.rb'
197
156
  - 'spec/lutaml/xml/parsers/xml_spec.rb'
198
157
 
199
- # Offense count: 22
200
158
  # Configuration parameters: IgnoredMetadata.
201
159
  RSpec/DescribeClass:
202
160
  Enabled: false
203
161
 
204
- # Offense count: 649
205
162
  # Configuration parameters: CountAsOne.
206
163
  RSpec/ExampleLength:
207
164
  Max: 30
208
165
 
209
- # Offense count: 7
210
166
  # This cop supports safe autocorrection (--autocorrect).
211
167
  RSpec/ExpectActual:
212
168
  Exclude:
213
169
  - 'spec/lutaml/qea/diagram_support_spec.rb'
214
170
  - 'spec/lutaml/qea/services/configuration_spec.rb'
215
171
 
216
- # Offense count: 1
217
172
  RSpec/ExpectInLet:
218
173
  Exclude:
219
174
  - 'spec/lutaml/ea/diagram/svg_accuracy_spec.rb'
220
175
 
221
- # Offense count: 90
222
176
  RSpec/ExpectOutput:
223
177
  Exclude:
224
178
  - 'spec/lutaml/cli/interactive_shell_spec.rb'
225
179
  - 'spec/lutaml/cli/package_commands_spec.rb'
226
180
 
227
- # Offense count: 5
228
181
  # Configuration parameters: Max, AllowedIdentifiers, AllowedPatterns.
229
182
  RSpec/IndexedLet:
230
183
  Exclude:
231
184
  - 'spec/lutaml/qea/repositories/base_repository_spec.rb'
232
185
  - 'spec/lutaml/qea/repositories/object_repository_spec.rb'
233
186
 
234
- # Offense count: 15
235
187
  RSpec/LeakyConstantDeclaration:
236
188
  Exclude:
237
189
  - 'spec/lutaml/model_transformations/format_registry_spec.rb'
@@ -240,12 +192,10 @@ RSpec/LeakyConstantDeclaration:
240
192
  - 'spec/lutaml/model_transformations_spec.rb'
241
193
  - 'spec/lutaml/uml_repository/presenters/presenter_factory_spec.rb'
242
194
 
243
- # Offense count: 1
244
195
  RSpec/LeakyLocalVariable:
245
196
  Exclude:
246
197
  - 'spec/lutaml/ea/diagram/svg_accuracy_spec.rb'
247
198
 
248
- # Offense count: 11
249
199
  # Configuration parameters: EnforcedStyle.
250
200
  # SupportedStyles: have_received, receive
251
201
  RSpec/MessageSpies:
@@ -255,21 +205,17 @@ RSpec/MessageSpies:
255
205
  - 'spec/lutaml/uml_repository/presenters/diagram_presenter_spec.rb'
256
206
  - 'spec/lutaml/uml_repository/repository_spec.rb'
257
207
 
258
- # Offense count: 39
259
208
  RSpec/MultipleExpectations:
260
209
  Max: 7
261
210
 
262
- # Offense count: 149
263
211
  # Configuration parameters: AllowSubject.
264
212
  RSpec/MultipleMemoizedHelpers:
265
213
  Max: 11
266
214
 
267
- # Offense count: 33
268
215
  # Configuration parameters: AllowedGroups.
269
216
  RSpec/NestedGroups:
270
217
  Max: 4
271
218
 
272
- # Offense count: 2
273
219
  # Configuration parameters: AllowedPatterns.
274
220
  # AllowedPatterns: ^expect_, ^assert_
275
221
  RSpec/NoExpectationExample:
@@ -277,7 +223,6 @@ RSpec/NoExpectationExample:
277
223
  - 'spec/lutaml/qea/verification/comprehensive_equivalence_spec.rb'
278
224
  - 'spec/lutaml/uml_repository/static_site/generator_spec.rb'
279
225
 
280
- # Offense count: 12
281
226
  RSpec/RepeatedExample:
282
227
  Exclude:
283
228
  - 'spec/lutaml/cli/package_commands_spec.rb'
@@ -285,12 +230,10 @@ RSpec/RepeatedExample:
285
230
  - 'spec/lutaml/qea/validation/validation_engine_spec.rb'
286
231
  - 'spec/lutaml/uml_repository/static_site/data_transformer_spec.rb'
287
232
 
288
- # Offense count: 2
289
233
  RSpec/RepeatedExampleGroupDescription:
290
234
  Exclude:
291
235
  - 'spec/lutaml/uml/parsers/dsl_spec.rb'
292
236
 
293
- # Offense count: 4
294
237
  # Configuration parameters: CustomTransform, IgnoreMethods, IgnoreMetadata, InflectorPath, EnforcedInflector.
295
238
  # SupportedInflectors: default, active_support
296
239
  RSpec/SpecFilePathFormat:
@@ -300,64 +243,22 @@ RSpec/SpecFilePathFormat:
300
243
  - 'spec/lutaml/parsers/serialize_xmi_to_liquid_spec.rb'
301
244
  - 'spec/lutaml/uml_repository/web_ui/app_spec.rb'
302
245
 
303
- # Offense count: 3
304
- Security/Eval:
305
- Exclude:
306
- - 'spec/lutaml/cli/uml/search_command_spec.rb'
307
-
308
- # Offense count: 2
309
246
  Security/MarshalLoad:
310
247
  Exclude:
311
248
  - 'lib/lutaml/uml_repository/package_loader.rb'
312
249
 
313
- # Offense count: 2
314
250
  # This cop supports safe autocorrection (--autocorrect).
315
251
  Style/ComparableClamp:
316
252
  Exclude:
317
253
  - 'lib/lutaml/cli/enhanced_formatter.rb'
318
254
 
319
- # Offense count: 2
320
- Style/DocumentDynamicEvalDefinition:
321
- Exclude:
322
- - 'spec/lutaml/cli/uml/search_command_spec.rb'
323
-
324
- # Offense count: 2
325
- # This cop supports safe autocorrection (--autocorrect).
326
- Style/EvalWithLocation:
327
- Exclude:
328
- - 'spec/lutaml/cli/uml/search_command_spec.rb'
329
-
330
- # Offense count: 2
331
- # This cop supports safe autocorrection (--autocorrect).
332
- Style/MultilineIfModifier:
333
- Exclude:
334
- - 'lib/lutaml/uml_repository/index_builders/class_index.rb'
335
-
336
- # Offense count: 1
337
255
  # This cop supports unsafe autocorrection (--autocorrect-all).
338
256
  Style/PartitionInsteadOfDoubleSelect:
339
257
  Exclude:
340
258
  - 'lib/lutaml/qea/factory/generalization_builder.rb'
341
259
 
342
- # Offense count: 3
343
260
  # Configuration parameters: Max.
344
261
  Style/SafeNavigationChainLength:
345
262
  Exclude:
346
263
  - 'lib/lutaml/qea/validation/attribute_validator.rb'
347
264
  - 'lib/lutaml/qea/validation/operation_validator.rb'
348
-
349
- # Offense count: 8
350
- # This cop supports safe autocorrection (--autocorrect).
351
- # Configuration parameters: EnforcedStyle.
352
- # SupportedStyles: single_quotes, double_quotes
353
- Style/StringLiteralsInInterpolation:
354
- Exclude:
355
- - 'lib/lutaml/cli/interactive_shell/help_display.rb'
356
-
357
- # Offense count: 1
358
- # This cop supports safe autocorrection (--autocorrect).
359
- # Configuration parameters: EnforcedStyle, AllowSafeAssignment.
360
- # SupportedStyles: require_parentheses, require_no_parentheses, require_parentheses_when_complex
361
- Style/TernaryParentheses:
362
- Exclude:
363
- - 'lib/lutaml/qea/factory/association_builder.rb'
data/CLAUDE.md ADDED
@@ -0,0 +1,38 @@
1
+ # CLAUDE.md — Lutaml Project
2
+
3
+ ## Project Overview
4
+ Lutaml is a Ruby gem for parsing and transforming UML models from multiple formats (XMI, QEA/EA, DSL). It provides a CLI, interactive shell, static site generator, web UI, and model transformation pipeline.
5
+
6
+ ## Testing Constraints
7
+
8
+ **CRITICAL: Do NOT run the full test suite at once.** It will crash due to memory. Run targeted subsets:
9
+ - `bundle exec rspec spec/lutaml/cli/` — CLI specs
10
+ - `bundle exec rspec spec/lutaml/qea/` — QEA parser specs
11
+ - `bundle exec rspec spec/lutaml/uml_repository/` — UML repository specs
12
+ - `bundle exec rspec spec/lutaml/uml/` — UML model specs
13
+ - `bundle exec rspec spec/lutaml/parsers/` — Parser specs
14
+ - `bundle exec rspec spec/lutaml/formatter/` — Formatter specs
15
+ - Combine at most 2-3 suites at a time for targeted verification.
16
+
17
+ ## Code Quality Rules
18
+ - Never use `send` (breaks encapsulation). Use `public_send` only when dynamic dispatch is truly necessary.
19
+ - Never use `respond_to?` (poor typing). Use `is_a?` for type checks.
20
+ - Extract god methods into focused helpers.
21
+ - Keep files under ~300 lines. Extract into modules/classes when growing.
22
+ - DRY: consolidate duplicated patterns (especially `format_definition`, index building, metadata construction).
23
+ - Never commit TODO tracking files to git.
24
+
25
+ ## Architecture
26
+ - `lib/lutaml/uml/` — UML domain models (Class, Association, Package, etc.)
27
+ - `lib/lutaml/uml_repository/` — Repository pattern over UML documents (queries, presenters, exporters, SPA)
28
+ - `lib/lutaml/qea/` — EA .qea SQLite parser and factory
29
+ - `lib/lutaml/xmi/` — XMI XML parsing
30
+ - `lib/lutaml/converter/` — Format converters (XMI→UML, DSL→UML)
31
+ - `lib/lutaml/cli/` — Thor CLI commands
32
+ - `lib/lutaml/model_transformations/` — Format-agnostic transformation pipeline
33
+ - `lib/lutaml/ea/` — EA diagram SVG rendering
34
+
35
+ ## CI Notes
36
+ - Ignore Ruby 3.4 ubuntu failures (performance-related, not code issues)
37
+ - Ignore macOS job slowness (GitHub Actions is slow for macOS)
38
+ - Windows tempfile Permission denied errors are pre-existing flakiness
@@ -13,19 +13,17 @@ module Lutaml
13
13
  }.freeze
14
14
 
15
15
  def cmd_export(args)
16
- if last_results.nil? || last_results.empty?
17
- puts OutputFormatter.warning("No results to export")
18
- return
19
- end
16
+ return warn_no_results if last_results.nil? || last_results.empty?
17
+ return warn_export_usage unless valid_export_args?(args)
20
18
 
21
- if args.size < 3 || args[0] != "last"
22
- puts OutputFormatter.warning("Usage: export last FORMAT FILE")
23
- return
24
- end
19
+ dispatch_export(args[1].downcase, args[2])
20
+ end
25
21
 
26
- format = args[1].downcase
27
- file_path = args[2]
22
+ def valid_export_args?(args)
23
+ args.size >= 3 && args[0] == "last"
24
+ end
28
25
 
26
+ def dispatch_export(format, file_path)
29
27
  exporter = EXPORT_FORMATS[format]
30
28
  if exporter
31
29
  public_send(exporter, file_path)
@@ -34,6 +32,14 @@ module Lutaml
34
32
  end
35
33
  end
36
34
 
35
+ def warn_no_results
36
+ puts OutputFormatter.warning("No results to export")
37
+ end
38
+
39
+ def warn_export_usage
40
+ puts OutputFormatter.warning("Usage: export last FORMAT FILE")
41
+ end
42
+
37
43
  def export_csv(file_path)
38
44
  require "csv"
39
45
 
@@ -60,42 +60,44 @@ module Lutaml
60
60
  end
61
61
  end
62
62
 
63
+ HELP_TEXT = <<~HELP
64
+ Available Commands:
65
+
66
+ Navigation:
67
+ cd PATH Change to package path
68
+ pwd Print current path
69
+ ls [PATH] List packages
70
+ tree [PATH] Show package tree
71
+ up Go to parent package
72
+ root Go to ModelRoot
73
+ back Go to previous location
74
+
75
+ Query:
76
+ find CLASS Find class (fuzzy search)
77
+ show class QNAME Show class details
78
+ show package PATH Show package details
79
+ show NUMBER Show numbered result
80
+ search QUERY Full-text search
81
+ ? QUERY Alias for search
82
+
83
+ Bookmarks:
84
+ bookmark add NAME Bookmark current location
85
+ bookmark list List bookmarks
86
+ bookmark go NAME Jump to bookmark
87
+ bookmark rm NAME Remove bookmark
88
+ bm NAME Quick jump
89
+
90
+ Utilities:
91
+ help [COMMAND] Show help
92
+ history Show command history
93
+ clear Clear screen
94
+ config Show configuration
95
+ stats Show statistics
96
+ exit, quit, q Exit shell
97
+ HELP
98
+
63
99
  def display_general_help
64
- puts <<~HELP
65
- #{OutputFormatter.colorize('Available Commands:', :cyan)}
66
-
67
- #{OutputFormatter.colorize('Navigation:', :yellow)}
68
- cd PATH Change to package path
69
- pwd Print current path
70
- ls [PATH] List packages
71
- tree [PATH] Show package tree
72
- up Go to parent package
73
- root Go to ModelRoot
74
- back Go to previous location
75
-
76
- #{OutputFormatter.colorize('Query:', :yellow)}
77
- find CLASS Find class (fuzzy search)
78
- show class QNAME Show class details
79
- show package PATH Show package details
80
- show NUMBER Show numbered result
81
- search QUERY Full-text search
82
- ? QUERY Alias for search
83
-
84
- #{OutputFormatter.colorize('Bookmarks:', :yellow)}
85
- bookmark add NAME Bookmark current location
86
- bookmark list List bookmarks
87
- bookmark go NAME Jump to bookmark
88
- bookmark rm NAME Remove bookmark
89
- bm NAME Quick jump
90
-
91
- #{OutputFormatter.colorize('Utilities:', :yellow)}
92
- help [COMMAND] Show help
93
- history Show command history
94
- clear Clear screen
95
- config Show configuration
96
- stats Show statistics
97
- exit, quit, q Exit shell
98
- HELP
100
+ puts OutputFormatter.colorize(HELP_TEXT, :cyan)
99
101
  end
100
102
 
101
103
  def display_command_help(command)
@@ -95,14 +95,18 @@ module Lutaml
95
95
  return path if path.start_with?("ModelRoot")
96
96
  return current_path if path == "."
97
97
  return "ModelRoot" if path == "/"
98
+ return resolve_parent_path(path) if path.start_with?("../")
99
+ return resolve_child_path(path) if path.start_with?("./")
98
100
 
99
- if path.start_with?("../")
100
- resolve_parent_path(path)
101
- elsif path.start_with?("./")
102
- "#{current_path}::#{path[2..]}"
103
- else
104
- current_path == "ModelRoot" ? path : "#{current_path}::#{path}"
105
- end
101
+ resolve_simple_path(path)
102
+ end
103
+
104
+ def resolve_child_path(path)
105
+ "#{current_path}::#{path[2..]}"
106
+ end
107
+
108
+ def resolve_simple_path(path)
109
+ current_path == "ModelRoot" ? path : "#{current_path}::#{path}"
106
110
  end
107
111
 
108
112
  private
@@ -172,8 +172,14 @@ module Lutaml
172
172
  puts ""
173
173
  puts "Name: #{cls.name}"
174
174
 
175
- return unless cls.is_a?(Lutaml::Uml::Classifier) && cls.attributes && !cls.attributes.empty?
175
+ display_class_attributes(cls) if has_displayable_attributes?(cls)
176
+ end
177
+
178
+ def has_displayable_attributes?(cls)
179
+ cls.is_a?(Lutaml::Uml::Classifier) && cls.attributes && !cls.attributes.empty?
180
+ end
176
181
 
182
+ def display_class_attributes(cls)
177
183
  puts ""
178
184
  puts OutputFormatter.colorize("Attributes:", :yellow)
179
185
  cls.attributes.each do |attr|
@@ -188,6 +194,10 @@ module Lutaml
188
194
  puts "Name: #{pkg.name}"
189
195
  puts ""
190
196
 
197
+ display_package_classes(path)
198
+ end
199
+
200
+ def display_package_classes(path)
191
201
  classes = repository.classes_in_package(path)
192
202
  puts OutputFormatter.colorize("Classes (#{classes.size}):", :yellow)
193
203
  classes.each do |cls|
@@ -88,14 +88,22 @@ module Lutaml
88
88
  deduplicate_history(input)
89
89
  execute_command(input.strip)
90
90
  rescue Interrupt
91
- puts "\nUse 'exit' or 'quit' to exit the shell"
91
+ handle_interrupt
92
92
  rescue StandardError => e
93
- puts OutputFormatter.error("Error: #{e.message}")
94
- puts e.backtrace.first(3).join("\n") if ENV["DEBUG"]
93
+ handle_error(e)
95
94
  end
96
95
  end
97
96
  end
98
97
 
98
+ def handle_interrupt
99
+ puts "\nUse 'exit' or 'quit' to exit the shell"
100
+ end
101
+
102
+ def handle_error(error)
103
+ puts OutputFormatter.error("Error: #{error.message}")
104
+ puts error.backtrace.first(3).join("\n") if ENV["DEBUG"]
105
+ end
106
+
99
107
  def deduplicate_history(input)
100
108
  if Readline::HISTORY.length > 1 && Readline::HISTORY[-2] == input
101
109
  Readline::HISTORY.pop
@@ -275,13 +275,21 @@ module Lutaml
275
275
 
276
276
  # Determine class type (class, interface, enumeration)
277
277
  def determine_class_type(klass)
278
- return :enumeration if klass.class.name&.include?("Enum")
279
- return :interface if klass.is_a?(Lutaml::Uml::TopElement) &&
280
- Array(klass.stereotype).any? { |s| s&.downcase == "interface" }
278
+ return :enumeration if enumeration?(klass)
279
+ return :interface if interface?(klass)
281
280
 
282
281
  :class
283
282
  end
284
283
 
284
+ def enumeration?(klass)
285
+ klass.class.name&.include?("Enum")
286
+ end
287
+
288
+ def interface?(klass)
289
+ klass.is_a?(Lutaml::Uml::TopElement) &&
290
+ Array(klass.stereotype).any? { |s| s&.downcase == "interface" }
291
+ end
292
+
285
293
  # Find package path for a package object
286
294
  def find_package_path(repository, package)
287
295
  repository.indexes[:package_paths].each do |path, pkg|