canon 0.1.7 → 0.1.9

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 (77) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop_todo.yml +69 -92
  3. data/README.adoc +13 -13
  4. data/docs/.lycheeignore +69 -0
  5. data/docs/Gemfile +1 -0
  6. data/docs/_config.yml +90 -1
  7. data/docs/advanced/diff-classification.adoc +82 -2
  8. data/docs/advanced/extending-canon.adoc +193 -0
  9. data/docs/features/match-options/index.adoc +239 -1
  10. data/docs/internals/diffnode-enrichment.adoc +611 -0
  11. data/docs/internals/index.adoc +251 -0
  12. data/docs/lychee.toml +13 -6
  13. data/docs/understanding/architecture.adoc +749 -33
  14. data/docs/understanding/comparison-pipeline.adoc +122 -0
  15. data/lib/canon/cache.rb +129 -0
  16. data/lib/canon/comparison/dimensions/attribute_order_dimension.rb +68 -0
  17. data/lib/canon/comparison/dimensions/attribute_presence_dimension.rb +68 -0
  18. data/lib/canon/comparison/dimensions/attribute_values_dimension.rb +171 -0
  19. data/lib/canon/comparison/dimensions/base_dimension.rb +107 -0
  20. data/lib/canon/comparison/dimensions/comments_dimension.rb +121 -0
  21. data/lib/canon/comparison/dimensions/element_position_dimension.rb +90 -0
  22. data/lib/canon/comparison/dimensions/registry.rb +77 -0
  23. data/lib/canon/comparison/dimensions/structural_whitespace_dimension.rb +119 -0
  24. data/lib/canon/comparison/dimensions/text_content_dimension.rb +96 -0
  25. data/lib/canon/comparison/dimensions.rb +54 -0
  26. data/lib/canon/comparison/format_detector.rb +87 -0
  27. data/lib/canon/comparison/html_comparator.rb +70 -26
  28. data/lib/canon/comparison/html_compare_profile.rb +8 -2
  29. data/lib/canon/comparison/html_parser.rb +80 -0
  30. data/lib/canon/comparison/json_comparator.rb +12 -0
  31. data/lib/canon/comparison/json_parser.rb +19 -0
  32. data/lib/canon/comparison/markup_comparator.rb +293 -0
  33. data/lib/canon/comparison/match_options/base_resolver.rb +150 -0
  34. data/lib/canon/comparison/match_options/json_resolver.rb +82 -0
  35. data/lib/canon/comparison/match_options/xml_resolver.rb +151 -0
  36. data/lib/canon/comparison/match_options/yaml_resolver.rb +87 -0
  37. data/lib/canon/comparison/match_options.rb +68 -463
  38. data/lib/canon/comparison/profile_definition.rb +149 -0
  39. data/lib/canon/comparison/ruby_object_comparator.rb +180 -0
  40. data/lib/canon/comparison/strategies/semantic_tree_match_strategy.rb +7 -10
  41. data/lib/canon/comparison/whitespace_sensitivity.rb +208 -0
  42. data/lib/canon/comparison/xml_comparator/attribute_comparator.rb +177 -0
  43. data/lib/canon/comparison/xml_comparator/attribute_filter.rb +136 -0
  44. data/lib/canon/comparison/xml_comparator/child_comparison.rb +197 -0
  45. data/lib/canon/comparison/xml_comparator/diff_node_builder.rb +115 -0
  46. data/lib/canon/comparison/xml_comparator/namespace_comparator.rb +186 -0
  47. data/lib/canon/comparison/xml_comparator/node_parser.rb +79 -0
  48. data/lib/canon/comparison/xml_comparator/node_type_comparator.rb +102 -0
  49. data/lib/canon/comparison/xml_comparator.rb +97 -684
  50. data/lib/canon/comparison/xml_node_comparison.rb +319 -0
  51. data/lib/canon/comparison/xml_parser.rb +19 -0
  52. data/lib/canon/comparison/yaml_comparator.rb +3 -3
  53. data/lib/canon/comparison.rb +265 -110
  54. data/lib/canon/diff/diff_classifier.rb +101 -2
  55. data/lib/canon/diff/diff_node.rb +32 -2
  56. data/lib/canon/diff/formatting_detector.rb +1 -1
  57. data/lib/canon/diff/node_serializer.rb +191 -0
  58. data/lib/canon/diff/path_builder.rb +143 -0
  59. data/lib/canon/diff_formatter/by_line/base_formatter.rb +251 -0
  60. data/lib/canon/diff_formatter/by_line/html_formatter.rb +6 -248
  61. data/lib/canon/diff_formatter/by_line/xml_formatter.rb +38 -229
  62. data/lib/canon/diff_formatter/diff_detail_formatter/color_helper.rb +30 -0
  63. data/lib/canon/diff_formatter/diff_detail_formatter/dimension_formatter.rb +579 -0
  64. data/lib/canon/diff_formatter/diff_detail_formatter/location_extractor.rb +121 -0
  65. data/lib/canon/diff_formatter/diff_detail_formatter/node_utils.rb +253 -0
  66. data/lib/canon/diff_formatter/diff_detail_formatter/text_utils.rb +61 -0
  67. data/lib/canon/diff_formatter/diff_detail_formatter.rb +31 -1028
  68. data/lib/canon/diff_formatter.rb +1 -1
  69. data/lib/canon/rspec_matchers.rb +38 -9
  70. data/lib/canon/tree_diff/operation_converter.rb +92 -338
  71. data/lib/canon/tree_diff/operation_converter_helpers/metadata_enricher.rb +71 -0
  72. data/lib/canon/tree_diff/operation_converter_helpers/post_processor.rb +103 -0
  73. data/lib/canon/tree_diff/operation_converter_helpers/reason_builder.rb +168 -0
  74. data/lib/canon/tree_diff/operation_converter_helpers/update_change_handler.rb +188 -0
  75. data/lib/canon/version.rb +1 -1
  76. data/lib/canon/xml/data_model.rb +24 -13
  77. metadata +48 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 74adcfa8d9b6ab7cc95fba2557dcfecbfa0dbd134e90497a30195fb476de6b42
4
- data.tar.gz: dab1ef7a6c5fe852b6935561ddb85e2ffdde6edf4463b36cbe2f9deb5251b4f2
3
+ metadata.gz: 24f79ae4b9b6817104e388a5bef96d24677f797db5d13bd6f009a26a04170137
4
+ data.tar.gz: 3b8260af8e2157f2f449421b3d40649521ba64495a15f7667e64c3e343b6d3b7
5
5
  SHA512:
6
- metadata.gz: 98b8e102b110e5a85363a3ccceb28ffb87082f9695ad0c39b182a1f9f3bca7fc652c471a2134cc621b84d9acfaa858f10aea5c9ddb6a90f5e098ed5b3cd795c5
7
- data.tar.gz: 1db527549bde5c60b0f45a8d34a59c877ed9b880a9ea80f076b2501319886e1300d036fd5502820d361d06d9a4957a9b648d479aaf98dcf0bc55bb26f9673066
6
+ metadata.gz: 971daa53fd96c5c46b5c37c2175f12875e7e36f658cc4186848f1df90ab3db9ceff06af69320e5004d1da1d6b2dc4b35d800c5aca1b1522ac05cf14c73025c21
7
+ data.tar.gz: 02f5160a42bf651db2a252909966cbc7dea43239cbbae2a53d155c55c4e09709eddc34e599496bfc5cda14705931f24efbebd267b9acc8700b834fb859d8096f
data/.rubocop_todo.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2025-12-22 03:34:50 UTC using RuboCop version 1.81.7.
3
+ # on 2026-01-20 02:18:38 UTC using RuboCop version 1.81.7.
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
@@ -12,34 +12,32 @@ Gemspec/RequiredRubyVersion:
12
12
  Exclude:
13
13
  - 'canon.gemspec'
14
14
 
15
- # Offense count: 1
16
- # This cop supports safe autocorrection (--autocorrect).
17
- # Configuration parameters: EnforcedStyle, IndentationWidth.
18
- # SupportedStyles: with_first_argument, with_fixed_indentation
19
- Layout/ArgumentAlignment:
20
- Exclude:
21
- - 'spec/canon/comparison/multiple_differences_spec.rb'
22
-
23
15
  # Offense count: 2
24
16
  # This cop supports safe autocorrection (--autocorrect).
25
17
  # Configuration parameters: EnforcedStyleAlignWith.
26
18
  # SupportedStylesAlignWith: either, start_of_block, start_of_line
27
19
  Layout/BlockAlignment:
28
20
  Exclude:
29
- - 'lib/canon/diff_formatter/by_line/html_formatter.rb'
30
- - 'spec/canon/diff/diff_node_mapper_granularity_spec.rb'
21
+ - 'spec/canon/rspec_matchers_spec.rb'
31
22
 
32
- # Offense count: 1
23
+ # Offense count: 2
33
24
  # This cop supports safe autocorrection (--autocorrect).
34
25
  Layout/BlockEndNewline:
35
26
  Exclude:
36
- - 'spec/canon/diff/diff_node_mapper_granularity_spec.rb'
27
+ - 'spec/canon/rspec_matchers_spec.rb'
28
+
29
+ # Offense count: 2
30
+ # This cop supports safe autocorrection (--autocorrect).
31
+ # Configuration parameters: AllowForAlignment.
32
+ Layout/CommentIndentation:
33
+ Exclude:
34
+ - 'lib/canon/comparison/xml_comparator.rb'
37
35
 
38
36
  # Offense count: 1
39
37
  # This cop supports safe autocorrection (--autocorrect).
40
38
  Layout/ElseAlignment:
41
39
  Exclude:
42
- - 'lib/canon/diff_formatter/by_object/base_formatter.rb'
40
+ - 'lib/canon/comparison/xml_comparator.rb'
43
41
 
44
42
  # Offense count: 1
45
43
  # This cop supports safe autocorrection (--autocorrect).
@@ -47,34 +45,24 @@ Layout/ElseAlignment:
47
45
  # SupportedStylesAlignWith: keyword, variable, start_of_line
48
46
  Layout/EndAlignment:
49
47
  Exclude:
50
- - 'lib/canon/diff_formatter/by_object/base_formatter.rb'
48
+ - 'lib/canon/comparison/xml_comparator.rb'
51
49
 
52
50
  # Offense count: 1
53
51
  # This cop supports safe autocorrection (--autocorrect).
54
- # Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment.
55
- Layout/ExtraSpacing:
56
- Exclude:
57
- - 'lib/canon/commands/diff_command.rb'
58
-
59
- # Offense count: 3
60
- # This cop supports safe autocorrection (--autocorrect).
61
- # Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
62
- # SupportedHashRocketStyles: key, separator, table
63
- # SupportedColonStyles: key, separator, table
64
- # SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
65
- Layout/HashAlignment:
52
+ # Configuration parameters: EnforcedStyle.
53
+ # SupportedStyles: normal, indented_internal_methods
54
+ Layout/IndentationConsistency:
66
55
  Exclude:
67
- - 'spec/canon/comparison/multiple_differences_spec.rb'
56
+ - 'lib/canon/comparison/xml_comparator.rb'
68
57
 
69
58
  # Offense count: 4
70
59
  # This cop supports safe autocorrection (--autocorrect).
71
60
  # Configuration parameters: Width, AllowedPatterns.
72
61
  Layout/IndentationWidth:
73
62
  Exclude:
74
- - 'lib/canon/diff_formatter/by_object/base_formatter.rb'
75
- - 'spec/canon/diff/diff_node_mapper_granularity_spec.rb'
63
+ - 'spec/canon/rspec_matchers_spec.rb'
76
64
 
77
- # Offense count: 654
65
+ # Offense count: 655
78
66
  # This cop supports safe autocorrection (--autocorrect).
79
67
  # Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings.
80
68
  # URISchemes: http, https
@@ -83,31 +71,17 @@ Layout/LineLength:
83
71
 
84
72
  # Offense count: 3
85
73
  # This cop supports safe autocorrection (--autocorrect).
86
- # Configuration parameters: EnforcedStyle.
87
- # SupportedStyles: final_newline, final_blank_line
88
- Layout/TrailingEmptyLines:
74
+ # Configuration parameters: EnforcedStyle, IndentationWidth.
75
+ # SupportedStyles: aligned, indented
76
+ Layout/MultilineOperationIndentation:
89
77
  Exclude:
90
- - 'spec/canon/commands/diff_command_spec.rb'
91
- - 'spec/canon/comparison/multiple_differences_spec.rb'
92
- - 'spec/canon/diff/diff_classifier_spec.rb'
78
+ - 'lib/canon/diff/diff_classifier.rb'
93
79
 
94
- # Offense count: 10
95
- # This cop supports safe autocorrection (--autocorrect).
96
- # Configuration parameters: AllowInHeredoc.
97
- Layout/TrailingWhitespace:
98
- Exclude:
99
- - 'spec/canon/comparison/multiple_differences_spec.rb'
100
-
101
- # Offense count: 46
80
+ # Offense count: 48
102
81
  # Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches, IgnoreDuplicateElseBranch.
103
82
  Lint/DuplicateBranch:
104
83
  Enabled: false
105
84
 
106
- # Offense count: 2
107
- Lint/DuplicateMethods:
108
- Exclude:
109
- - 'lib/canon/diff_formatter/by_line/html_formatter.rb'
110
-
111
85
  # Offense count: 2
112
86
  # This cop supports safe autocorrection (--autocorrect).
113
87
  # Configuration parameters: AllowComments.
@@ -132,63 +106,58 @@ Lint/UnreachableCode:
132
106
  Exclude:
133
107
  - 'lib/canon/diff_formatter/debug_output.rb'
134
108
 
135
- # Offense count: 7
109
+ # Offense count: 6
136
110
  # This cop supports safe autocorrection (--autocorrect).
137
111
  # Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods, NotImplementedExceptions.
138
112
  # NotImplementedExceptions: NotImplementedError
139
113
  Lint/UnusedMethodArgument:
140
114
  Exclude:
141
- - 'lib/canon/comparison/match_options.rb'
115
+ - 'lib/canon/diff/path_builder.rb'
142
116
  - 'lib/canon/diff_formatter/by_line/base_formatter.rb'
143
117
  - 'lib/canon/diff_formatter/by_line/xml_formatter.rb'
144
118
  - 'lib/canon/diff_formatter/by_object/base_formatter.rb'
145
119
 
146
- # Offense count: 219
120
+ # Offense count: 194
147
121
  # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max.
148
122
  Metrics/AbcSize:
149
123
  Enabled: false
150
124
 
151
- # Offense count: 27
125
+ # Offense count: 20
152
126
  # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns, inherit_mode.
153
127
  # AllowedMethods: refine
154
128
  Metrics/BlockLength:
155
129
  Max: 84
156
130
 
157
- # Offense count: 2
158
- # Configuration parameters: CountBlocks, CountModifierForms.
159
- Metrics/BlockNesting:
160
- Max: 4
161
-
162
- # Offense count: 180
131
+ # Offense count: 164
163
132
  # Configuration parameters: AllowedMethods, AllowedPatterns, Max.
164
133
  Metrics/CyclomaticComplexity:
165
134
  Enabled: false
166
135
 
167
- # Offense count: 347
136
+ # Offense count: 346
168
137
  # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
169
138
  Metrics/MethodLength:
170
- Max: 107
139
+ Max: 110
171
140
 
172
- # Offense count: 23
141
+ # Offense count: 45
173
142
  # Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
174
143
  Metrics/ParameterLists:
175
144
  Max: 9
176
145
 
177
- # Offense count: 142
146
+ # Offense count: 131
178
147
  # Configuration parameters: AllowedMethods, AllowedPatterns, Max.
179
148
  Metrics/PerceivedComplexity:
180
149
  Enabled: false
181
150
 
182
- # Offense count: 29
151
+ # Offense count: 28
183
152
  # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
184
153
  # AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to
185
154
  Naming/MethodParameterName:
186
155
  Exclude:
187
156
  - 'lib/canon/comparison/xml_comparator.rb'
157
+ - 'lib/canon/comparison/xml_comparator/attribute_comparator.rb'
188
158
  - 'lib/canon/xml/namespace_handler.rb'
189
- - 'scripts/investigate_all_false_positives.rb'
190
159
 
191
- # Offense count: 2
160
+ # Offense count: 1
192
161
  # Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros, UseSorbetSigs.
193
162
  # NamePrefix: is_, has_, have_, does_
194
163
  # ForbiddenPrefixes: is_, has_, have_, does_
@@ -197,7 +166,6 @@ Naming/MethodParameterName:
197
166
  Naming/PredicatePrefix:
198
167
  Exclude:
199
168
  - 'lib/canon/comparison/html_comparator.rb'
200
- - 'lib/canon/comparison/xml_comparator.rb'
201
169
 
202
170
  # Offense count: 2
203
171
  # Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns.
@@ -207,21 +175,20 @@ Naming/VariableNumber:
207
175
  Exclude:
208
176
  - 'lib/canon/comparison/json_comparator.rb'
209
177
 
210
- # Offense count: 4
178
+ # Offense count: 2
211
179
  # Configuration parameters: MinSize.
212
180
  Performance/CollectionLiteralInLoop:
213
181
  Exclude:
214
182
  - 'lib/canon/comparison/html_comparator.rb'
215
- - 'lib/canon/diff_formatter/diff_detail_formatter.rb'
216
183
  - 'lib/canon/xml/xml_base_handler.rb'
217
184
 
218
- # Offense count: 58
185
+ # Offense count: 64
219
186
  # Configuration parameters: Prefixes, AllowedPatterns.
220
187
  # Prefixes: when, with, without
221
188
  RSpec/ContextWording:
222
189
  Enabled: false
223
190
 
224
- # Offense count: 24
191
+ # Offense count: 25
225
192
  # Configuration parameters: IgnoredMetadata.
226
193
  RSpec/DescribeClass:
227
194
  Enabled: false
@@ -232,7 +199,7 @@ RSpec/DescribeMethod:
232
199
  - 'spec/canon/comparison/multiple_differences_spec.rb'
233
200
  - 'spec/canon/diff_formatter/character_map_customization_spec.rb'
234
201
 
235
- # Offense count: 592
202
+ # Offense count: 663
236
203
  # Configuration parameters: CountAsOne.
237
204
  RSpec/ExampleLength:
238
205
  Max: 67
@@ -246,7 +213,7 @@ RSpec/ExpectActual:
246
213
  - 'spec/canon/rspec_matchers_spec.rb'
247
214
  - 'spec/canon/string_matcher_spec.rb'
248
215
 
249
- # Offense count: 171
216
+ # Offense count: 175
250
217
  # Configuration parameters: Max, AllowedIdentifiers, AllowedPatterns.
251
218
  RSpec/IndexedLet:
252
219
  Exclude:
@@ -269,12 +236,11 @@ RSpec/InstanceVariable:
269
236
  Exclude:
270
237
  - 'spec/canon/rspec_matchers_spec.rb'
271
238
 
272
- # Offense count: 16
239
+ # Offense count: 15
273
240
  # Configuration parameters: EnforcedStyle.
274
241
  # SupportedStyles: have_received, receive
275
242
  RSpec/MessageSpies:
276
243
  Exclude:
277
- - 'spec/canon/comparison/yaml_comparator_spec.rb'
278
244
  - 'spec/canon/diff/diff_classifier_spec.rb'
279
245
  - 'spec/canon_spec.rb'
280
246
  - 'spec/xml_c14n_spec.rb'
@@ -284,11 +250,11 @@ RSpec/MultipleDescribes:
284
250
  Exclude:
285
251
  - 'spec/canon/comparison/match_options_spec.rb'
286
252
 
287
- # Offense count: 489
253
+ # Offense count: 515
288
254
  RSpec/MultipleExpectations:
289
255
  Max: 15
290
256
 
291
- # Offense count: 66
257
+ # Offense count: 69
292
258
  # Configuration parameters: AllowSubject.
293
259
  RSpec/MultipleMemoizedHelpers:
294
260
  Max: 13
@@ -302,7 +268,7 @@ RSpec/NamedSubject:
302
268
  - 'spec/canon/pretty_printer/json_spec.rb'
303
269
  - 'spec/canon/pretty_printer/xml_spec.rb'
304
270
 
305
- # Offense count: 29
271
+ # Offense count: 37
306
272
  # Configuration parameters: AllowedGroups.
307
273
  RSpec/NestedGroups:
308
274
  Max: 4
@@ -330,14 +296,16 @@ RSpec/SpecFilePathFormat:
330
296
  - 'spec/canon/yaml/formatter_spec.rb'
331
297
  - 'spec/xml_c14n_spec.rb'
332
298
 
333
- # Offense count: 68
299
+ # Offense count: 95
334
300
  # Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
335
301
  RSpec/VerifiedDoubles:
336
302
  Exclude:
303
+ - 'spec/canon/comparison/whitespace_sensitivity_spec.rb'
337
304
  - 'spec/canon/diff/diff_classifier_spec.rb'
305
+ - 'spec/canon/diff/path_builder_spec.rb'
338
306
  - 'spec/canon/tree_diff/operation_converter_spec.rb'
339
307
 
340
- # Offense count: 1
308
+ # Offense count: 3
341
309
  # This cop supports safe autocorrection (--autocorrect).
342
310
  # Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, AllowedMethods, AllowedPatterns, AllowBracesOnProceduralOneLiners, BracesRequiredMethods.
343
311
  # SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
@@ -346,7 +314,7 @@ RSpec/VerifiedDoubles:
346
314
  # AllowedMethods: lambda, proc, it
347
315
  Style/BlockDelimiters:
348
316
  Exclude:
349
- - 'spec/canon/diff/diff_node_mapper_granularity_spec.rb'
317
+ - 'spec/canon/rspec_matchers_spec.rb'
350
318
 
351
319
  # Offense count: 1
352
320
  # This cop supports safe autocorrection (--autocorrect).
@@ -354,7 +322,7 @@ Style/BlockDelimiters:
354
322
  # SupportedStyles: empty, nil, both
355
323
  Style/EmptyElse:
356
324
  Exclude:
357
- - 'lib/canon/diff_formatter/diff_detail_formatter.rb'
325
+ - 'lib/canon/comparison/xml_comparator.rb'
358
326
 
359
327
  # Offense count: 3
360
328
  # Configuration parameters: MinBranchesCount.
@@ -363,10 +331,11 @@ Style/HashLikeCase:
363
331
  - 'lib/canon/diff/diff_block_builder.rb'
364
332
  - 'lib/canon/xml/character_encoder.rb'
365
333
 
366
- # Offense count: 4
334
+ # Offense count: 6
367
335
  # This cop supports unsafe autocorrection (--autocorrect-all).
368
336
  Style/IdenticalConditionalBranches:
369
337
  Exclude:
338
+ - 'lib/canon/comparison/xml_comparator.rb'
370
339
  - 'lib/canon/diff_formatter/by_object/base_formatter.rb'
371
340
  - 'lib/canon/diff_formatter/legend.rb'
372
341
 
@@ -377,18 +346,26 @@ Style/OptionalBooleanParameter:
377
346
  Exclude:
378
347
  - 'lib/canon/diff_formatter/debug_output.rb'
379
348
 
380
- # Offense count: 1
381
- # This cop supports unsafe autocorrection (--autocorrect-all).
382
- # Configuration parameters: Mode.
383
- Style/StringConcatenation:
349
+ # Offense count: 6
350
+ # This cop supports safe autocorrection (--autocorrect).
351
+ # Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
352
+ # SupportedStyles: single_quotes, double_quotes
353
+ Style/StringLiterals:
384
354
  Exclude:
385
- - 'lib/canon/diff_formatter/diff_detail_formatter.rb'
355
+ - 'spec/canon/rspec_matchers_spec.rb'
386
356
 
387
- # Offense count: 6
357
+ # Offense count: 5
388
358
  # This cop supports safe autocorrection (--autocorrect).
389
359
  # Configuration parameters: EnforcedStyleForMultiline.
390
360
  # SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma
391
361
  Style/TrailingCommaInArguments:
392
362
  Exclude:
393
- - 'lib/canon/commands/diff_command.rb'
394
- - 'spec/canon/commands/diff_command_spec.rb'
363
+ - 'spec/canon/rspec_matchers_spec.rb'
364
+
365
+ # Offense count: 3
366
+ # This cop supports safe autocorrection (--autocorrect).
367
+ # Configuration parameters: EnforcedStyleForMultiline.
368
+ # SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma
369
+ Style/TrailingCommaInHashLiteral:
370
+ Exclude:
371
+ - 'spec/canon/rspec_matchers_spec.rb'
data/README.adoc CHANGED
@@ -69,7 +69,7 @@ Canon::PrettyPrinter::Xml.new(indent: 2).format(xml_input)
69
69
  require 'canon/comparison'
70
70
 
71
71
  xml1 = '<root><a>1</a><b>2</b></root>'
72
- xml2 = '<root> <b>2</b> <a>1</a> </root>'
72
+ xml2 = '<root> <a>1</a> <b>2</b> </root>'
73
73
 
74
74
  Canon::Comparison.equivalent?(xml1, xml2)
75
75
  # => true (semantically equivalent despite formatting differences)
@@ -534,14 +534,14 @@ Each dimension can have one of three behaviors:
534
534
  ====
535
535
  ----
536
536
  # Default (strict mode): whitespace differences are normative
537
- xml1 = '<root><p>Hello world</p></root>'
538
- xml2 = '<root><p>Hello\nworld</p></root>'
537
+ xml1 = "<root><p>Hello world</p></root>"
538
+ xml2 = "<root><p>Hello \nworld</p></root>"
539
539
  Canon::Comparison.equivalent?(xml1, xml2) # => false
540
540
 
541
541
  # Normalize mode: whitespace-only differences are formatting-only
542
542
  Canon::Comparison.equivalent?(xml1, xml2,
543
- match: { text_content: :normalize, structural_whitespace: :normalize }
544
- ) # => true
543
+ match: { text_content: :normalize }
544
+ ) # => true
545
545
  ----
546
546
  ====
547
547
 
@@ -620,11 +620,11 @@ html1 = '<div><!-- comment --><p>Text</p></div>'
620
620
  html2 = '<div><p>Text</p></div>'
621
621
 
622
622
  # HTML defaults: comments are ignored (presentational)
623
- result = Canon::Comparison.equivalent?(html1, html2)
623
+ result = Canon::Comparison.equivalent?(html1, html2, format: :html)
624
624
  # => true (comments don't affect HTML equivalence by default)
625
625
 
626
626
  # Explicit strict matching
627
- result = Canon::Comparison.equivalent?(html1, html2,
627
+ result = Canon::Comparison.equivalent?(html1, html2, format: :html,
628
628
  match: { comments: :strict }
629
629
  )
630
630
  # => false (comments now affect equivalence)
@@ -638,17 +638,17 @@ don't affect the semantic meaning unless explicitly configured to `:strict`.
638
638
  ====
639
639
  [source,ruby]
640
640
  ----
641
- html1 = '<pre>Line 1\n Line 2</pre>'
642
- html2 = '<pre>Line 1\nLine 2</pre>'
641
+ html1 = "<pre>Line 1\n Line 2</pre>"
642
+ html2 = "<pre>Line 1\nLine 2</pre>"
643
643
 
644
644
  # Whitespace is preserved in <pre> elements
645
- result = Canon::Comparison.equivalent?(html1, html2)
645
+ result = Canon::Comparison::HtmlComparator.equivalent?(html1, html2)
646
646
  # => false (whitespace differs in pre element)
647
647
 
648
648
  # But normalized in other elements
649
- html3 = '<div>Text with spaces</div>'
650
- html4 = '<div>Text with spaces</div>'
651
- result = Canon::Comparison.equivalent?(html3, html4)
649
+ html3 = "<div>Text with\n spaces</div>"
650
+ html4 = "<div>Text with\n spaces</div>"
651
+ result = Canon::Comparison::HtmlComparator.equivalent?(html3, html4)
652
652
  # => true (whitespace normalized in regular elements)
653
653
  ----
654
654
 
@@ -0,0 +1,69 @@
1
+ # Lychee ignore patterns
2
+ # These link types are valid but lychee can't verify them
3
+
4
+ # Ignore all .adoc files (source files that don't exist in built site)
5
+ \.adoc$
6
+
7
+ # Ignore all .html files with inconsistent paths
8
+ \.html$
9
+
10
+ # Ignore all file:// URLs (link checker has inconsistent base URL handling for local files)
11
+ file://
12
+
13
+ # Ignore assets directory (CSS/JS files)
14
+ file://.*/assets/.*
15
+
16
+ # Ignore directory links with trailing slashes (web servers handle these with index.html)
17
+ file://.*/canon/$
18
+ file://.*/canon/.*/$
19
+ file://.*/docs/$
20
+ file://.*/docs/.*/$
21
+
22
+ # Ignore all /canon/* and /docs/* paths (may have inconsistent base URLs during link checking)
23
+ file://.*/canon/.*
24
+ file://.*/docs/.*
25
+
26
+ # Ignore asciidoc-style directory links without .html extension
27
+ file://.*/extending-canon$
28
+ file://.*/verbose-mode-architecture$
29
+ file://.*/cli/diff-command$
30
+ file://.*/cli/format-command$
31
+ file://.*/rspec/matchers$
32
+ file://.*/ruby-api/comparison$
33
+ file://.*/ruby-api/formatting$
34
+ file://.*/core-concepts$
35
+ file://.*/installation$
36
+ file://.*/quick-start$
37
+ file://.*/profiles$
38
+ file://.*/comparison-pipeline$
39
+ file://.*/migrating-from-xmldiff$
40
+ file://.*/performance-optimization$
41
+ file://.*/testing-xml-generation$
42
+ file://.*/debugging-test-failures$
43
+ file://.*/choosing-configuration$
44
+ file://.*/guides/choosing-configuration$
45
+ file://.*/environment-configuration/size-limits$
46
+ file://.*/environment-configuration/override-system$
47
+ file://.*/environment-configuration/input-validation$
48
+ file://.*/architecture$
49
+
50
+ # Ignore example domain links (these don't exist)
51
+ http://a\.com/.*
52
+ http://b\.com/.*
53
+ http://c\.com/.*
54
+ http://example\.com/.*
55
+ http://ns\.com/.*
56
+ http://shop\.com/.*
57
+ http://z\.com/.*
58
+
59
+ # Ignore GitHub-specific links
60
+ https://github\.com/[^/]+/[^/]+/edit/.*
61
+ https://github\.com/[^/]+/[^/]+/blob/.*
62
+
63
+ # Ignore mailto links
64
+ mailto:.*
65
+
66
+ # Ignore localhost links for development
67
+ http://localhost:.*
68
+ http://127\.0\.0\.1:.*
69
+ http://0\.0\.0\.0:.*
data/docs/Gemfile CHANGED
@@ -6,4 +6,5 @@ gem "just-the-docs"
6
6
 
7
7
  group :jekyll_plugins do
8
8
  gem "jekyll-seo-tag"
9
+ gem "jekyll-sitemap"
9
10
  end
data/docs/_config.yml CHANGED
@@ -12,8 +12,13 @@ repository: lutaml/canon
12
12
 
13
13
  # Theme
14
14
  theme: just-the-docs
15
+ remote_theme: just-the-docs/just-the-docs@v0.7.0
15
16
  color_scheme: light
16
17
 
18
+ # Logo (uncomment if you have a logo)
19
+ # logo: "/assets/images/logo.svg"
20
+ # favicon_ico: "/assets/images/favicon.ico"
21
+
17
22
  # AsciiDoc support
18
23
  asciidoc: {}
19
24
  asciidoctor:
@@ -63,10 +68,36 @@ heading_anchors: true
63
68
  # Footer
64
69
  footer_content: 'Copyright &copy; 2025 Ribose. Distributed under the <a href="https://github.com/lutaml/canon/blob/main/LICENSE.txt">BSD 2-Clause License</a>.'
65
70
 
71
+ # Footer last edit timestamp
72
+ last_edit_timestamp: true
73
+ last_edit_time_format: "%b %e %Y at %I:%M %p"
74
+
75
+ # Enable code copy button
76
+ enable_copy_code_button: true
77
+
78
+ # Callouts
79
+ callouts_level: quiet
80
+ callouts:
81
+ highlight:
82
+ color: yellow
83
+ important:
84
+ title: Important
85
+ color: blue
86
+ new:
87
+ title: New
88
+ color: green
89
+ note:
90
+ title: Note
91
+ color: purple
92
+ warning:
93
+ title: Warning
94
+ color: red
95
+
66
96
  # Plugins
67
97
  plugins:
68
98
  - jekyll-asciidoc
69
99
  - jekyll-seo-tag
100
+ - jekyll-sitemap
70
101
 
71
102
  # Markdown settings (for any markdown files)
72
103
  markdown: kramdown
@@ -75,6 +106,60 @@ kramdown:
75
106
  hard_wrap: false
76
107
  syntax_highlighter: rouge
77
108
 
109
+ # Collections for organizing content
110
+ collections:
111
+ # Core documentation pages (getting-started, interfaces, etc.)
112
+ pages:
113
+ permalink: "/:path/"
114
+ output: true
115
+
116
+ # Feature documentation
117
+ features:
118
+ permalink: "/:collection/:path/"
119
+ output: true
120
+
121
+ # Understanding/internal documentation
122
+ understanding:
123
+ permalink: "/:collection/:path/"
124
+ output: true
125
+
126
+ # Advanced topics
127
+ advanced:
128
+ permalink: "/:collection/:path/"
129
+ output: true
130
+
131
+ # Guides (task-oriented tutorials)
132
+ guides:
133
+ permalink: "/:collection/:path/"
134
+ output: true
135
+
136
+ # Reference documentation
137
+ reference:
138
+ permalink: "/:collection/:path/"
139
+ output: true
140
+
141
+ # Just the Docs collection configuration
142
+ just_the_docs:
143
+ collections:
144
+ pages:
145
+ name: Pages
146
+ nav_fold: false
147
+ features:
148
+ name: Features
149
+ nav_fold: true
150
+ understanding:
151
+ name: Understanding
152
+ nav_fold: true
153
+ advanced:
154
+ name: Advanced
155
+ nav_fold: true
156
+ guides:
157
+ name: Guides
158
+ nav_fold: true
159
+ reference:
160
+ name: Reference
161
+ nav_fold: true
162
+
78
163
  # Defaults
79
164
  defaults:
80
165
  - scope:
@@ -83,6 +168,10 @@ defaults:
83
168
  values:
84
169
  layout: default
85
170
 
171
+ # Include additional files
172
+ include:
173
+ - "*.adoc"
174
+
86
175
  # Exclude from processing
87
176
  exclude:
88
177
  - Gemfile
@@ -97,4 +186,4 @@ exclude:
97
186
  - .git
98
187
  - .gitignore
99
188
 
100
- permalink: pretty
189
+ permalink: pretty