canon 0.1.23 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +155 -30
- data/docs/INDEX.adoc +4 -0
- data/docs/advanced/diff-classification.adoc +3 -2
- data/docs/advanced/verbose-mode-architecture.adoc +23 -0
- data/docs/features/configuration-profiles.adoc +288 -0
- data/docs/features/diff-formatting/character-visualization.adoc +153 -454
- data/docs/features/diff-formatting/display-filtering.adoc +44 -0
- data/docs/features/diff-formatting/display-preprocessing.adoc +656 -0
- data/docs/features/diff-formatting/index.adoc +47 -0
- data/docs/features/diff-formatting/pretty-diff-mode.adoc +154 -0
- data/docs/features/environment-configuration/override-system.adoc +10 -3
- data/docs/features/index.adoc +9 -0
- data/docs/features/match-options/html-policies.adoc +3 -0
- data/docs/features/match-options/index.adoc +32 -42
- data/docs/features/match-options/pretty-printed-fixtures.adoc +270 -0
- data/docs/guides/choosing-configuration.adoc +22 -0
- data/docs/reference/environment-variables.adoc +121 -1
- data/docs/reference/options-across-interfaces.adoc +182 -2
- data/lib/canon/cli.rb +20 -0
- data/lib/canon/commands/diff_command.rb +7 -2
- data/lib/canon/commands/format_command.rb +1 -1
- data/lib/canon/comparison/html_comparator.rb +29 -19
- data/lib/canon/comparison/html_compare_profile.rb +4 -4
- data/lib/canon/comparison/markup_comparator.rb +12 -3
- data/lib/canon/comparison/match_options/base_resolver.rb +29 -7
- data/lib/canon/comparison/match_options/json_resolver.rb +9 -0
- data/lib/canon/comparison/match_options/xml_resolver.rb +16 -2
- data/lib/canon/comparison/match_options/yaml_resolver.rb +10 -0
- data/lib/canon/comparison/match_options.rb +4 -1
- data/lib/canon/comparison/whitespace_sensitivity.rb +189 -137
- data/lib/canon/comparison/xml_comparator/child_comparison.rb +21 -4
- data/lib/canon/comparison/xml_comparator.rb +14 -12
- data/lib/canon/comparison/xml_node_comparison.rb +51 -6
- data/lib/canon/comparison.rb +52 -9
- data/lib/canon/config/env_schema.rb +32 -4
- data/lib/canon/config/override_resolver.rb +16 -3
- data/lib/canon/config/profile_loader.rb +135 -0
- data/lib/canon/config/profiles/metanorma.yml +74 -0
- data/lib/canon/config/profiles/metanorma_debug.yml +8 -0
- data/lib/canon/config/type_converter.rb +8 -0
- data/lib/canon/config.rb +469 -5
- data/lib/canon/diff/diff_classifier.rb +41 -11
- data/lib/canon/diff_formatter/diff_detail_formatter/dimension_formatter.rb +48 -17
- data/lib/canon/diff_formatter/diff_detail_formatter/node_utils.rb +58 -0
- data/lib/canon/diff_formatter/diff_detail_formatter.rb +73 -17
- data/lib/canon/diff_formatter.rb +493 -36
- data/lib/canon/pretty_printer/xml_normalized.rb +395 -0
- data/lib/canon/rspec_matchers.rb +36 -0
- data/lib/canon/version.rb +1 -1
- data/lib/canon/xml/nodes/namespace_node.rb +4 -0
- data/lib/canon/xml/nodes/processing_instruction_node.rb +4 -0
- data/lib/canon/xml/nodes/root_node.rb +4 -0
- data/lib/canon/xml/nodes/text_node.rb +4 -0
- data/lib/tasks/performance_helpers.rb +2 -2
- metadata +24 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bfa3648b7c5308716c22fbdc377d875dc60d479eb0e376cfe347eb02a279d3d7
|
|
4
|
+
data.tar.gz: 87024447cc6a13eaa8cb9d1edf91d360e35d2e6cb5a1f2b7035c067050fae24a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6299802984ef5bab4c658c534105491f853c9d6cd297a5df49e5f8c83e0b36d1b01d140c1ea510002cf2916f3902035e764dcd589e4e01c5eec10c4ba76fda28
|
|
7
|
+
data.tar.gz: 42e73a1c3f80942d7ad102187b8a19148eb8a4046539eabb45561a716711fa3a51ea228e7bc372b4f675f4777db9ad964ed6c4873c19a5be9dc375af8639d92d
|
data/.rubocop_todo.yml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# This configuration was generated by
|
|
2
2
|
# `rubocop --auto-gen-config`
|
|
3
|
-
# on 2026-04-
|
|
3
|
+
# on 2026-04-12 07:40:40 UTC using RuboCop version 1.86.0.
|
|
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
|
|
@@ -11,39 +11,147 @@ Gemspec/RequiredRubyVersion:
|
|
|
11
11
|
Exclude:
|
|
12
12
|
- 'canon.gemspec'
|
|
13
13
|
|
|
14
|
-
# Offense count:
|
|
14
|
+
# Offense count: 49
|
|
15
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
16
|
+
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
|
17
|
+
# SupportedStyles: with_first_argument, with_fixed_indentation
|
|
18
|
+
Layout/ArgumentAlignment:
|
|
19
|
+
Exclude:
|
|
20
|
+
- 'lib/canon/comparison/whitespace_sensitivity.rb'
|
|
21
|
+
- 'lib/canon/comparison/xml_comparator.rb'
|
|
22
|
+
- 'lib/canon/comparison/xml_node_comparison.rb'
|
|
23
|
+
- 'lib/canon/config.rb'
|
|
24
|
+
- 'lib/canon/diff/diff_classifier.rb'
|
|
25
|
+
- 'lib/canon/diff_formatter.rb'
|
|
26
|
+
- 'lib/canon/diff_formatter/diff_detail_formatter/dimension_formatter.rb'
|
|
27
|
+
- 'lib/canon/pretty_printer/xml_normalized.rb'
|
|
28
|
+
- 'spec/canon/config/profile_loader_spec.rb'
|
|
29
|
+
- 'spec/canon/config/profile_spec.rb'
|
|
30
|
+
- 'spec/canon/diff_formatter/diff_detail_formatter_spec.rb'
|
|
31
|
+
- 'spec/canon/diff_formatter/pretty_diff_spec.rb'
|
|
32
|
+
- 'spec/canon/diff_formatter/show_diffs_filtering_spec.rb'
|
|
33
|
+
- 'spec/canon/pretty_printer/xml_normalized_spec.rb'
|
|
34
|
+
|
|
35
|
+
# Offense count: 3
|
|
36
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
37
|
+
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
|
38
|
+
# SupportedStyles: with_first_element, with_fixed_indentation
|
|
39
|
+
Layout/ArrayAlignment:
|
|
40
|
+
Exclude:
|
|
41
|
+
- 'lib/canon/comparison/match_options/base_resolver.rb'
|
|
42
|
+
- 'lib/canon/comparison/match_options/xml_resolver.rb'
|
|
43
|
+
- 'spec/canon/config/profile_spec.rb'
|
|
44
|
+
|
|
45
|
+
# Offense count: 16
|
|
15
46
|
# This cop supports safe autocorrection (--autocorrect).
|
|
16
47
|
# Configuration parameters: EnforcedStyleAlignWith.
|
|
17
48
|
# SupportedStylesAlignWith: either, start_of_block, start_of_line
|
|
18
49
|
Layout/BlockAlignment:
|
|
19
50
|
Exclude:
|
|
20
|
-
- 'lib/canon/
|
|
21
|
-
- '
|
|
51
|
+
- 'lib/canon/diff_formatter/diff_detail_formatter/node_utils.rb'
|
|
52
|
+
- 'lib/canon/pretty_printer/xml_normalized.rb'
|
|
53
|
+
- 'spec/canon/config/profile_loader_spec.rb'
|
|
54
|
+
- 'spec/canon/diff_formatter/display_preprocessing_spec.rb'
|
|
55
|
+
- 'spec/canon/diff_formatter/pretty_diff_spec.rb'
|
|
56
|
+
- 'spec/canon/diff_formatter/show_diffs_filtering_spec.rb'
|
|
57
|
+
- 'spec/canon/pretty_printer/xml_normalized_spec.rb'
|
|
22
58
|
|
|
23
|
-
# Offense count:
|
|
59
|
+
# Offense count: 16
|
|
24
60
|
# This cop supports safe autocorrection (--autocorrect).
|
|
25
61
|
Layout/BlockEndNewline:
|
|
26
62
|
Exclude:
|
|
27
|
-
- 'lib/canon/
|
|
28
|
-
- '
|
|
63
|
+
- 'lib/canon/diff_formatter/diff_detail_formatter/node_utils.rb'
|
|
64
|
+
- 'lib/canon/pretty_printer/xml_normalized.rb'
|
|
65
|
+
- 'spec/canon/config/profile_loader_spec.rb'
|
|
66
|
+
- 'spec/canon/diff_formatter/display_preprocessing_spec.rb'
|
|
67
|
+
- 'spec/canon/diff_formatter/pretty_diff_spec.rb'
|
|
68
|
+
- 'spec/canon/diff_formatter/show_diffs_filtering_spec.rb'
|
|
69
|
+
- 'spec/canon/pretty_printer/xml_normalized_spec.rb'
|
|
29
70
|
|
|
30
|
-
# Offense count:
|
|
71
|
+
# Offense count: 5
|
|
72
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
73
|
+
Layout/ClosingParenthesisIndentation:
|
|
74
|
+
Exclude:
|
|
75
|
+
- 'lib/canon/config/profile_loader.rb'
|
|
76
|
+
- 'lib/canon/diff/diff_classifier.rb'
|
|
77
|
+
- 'spec/canon/config/profile_loader_spec.rb'
|
|
78
|
+
|
|
79
|
+
# Offense count: 2
|
|
80
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
81
|
+
Layout/ElseAlignment:
|
|
82
|
+
Exclude:
|
|
83
|
+
- 'lib/canon/diff_formatter/diff_detail_formatter/dimension_formatter.rb'
|
|
84
|
+
|
|
85
|
+
# Offense count: 2
|
|
86
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
87
|
+
# Configuration parameters: EnforcedStyleAlignWith.
|
|
88
|
+
# SupportedStylesAlignWith: keyword, variable, start_of_line
|
|
89
|
+
Layout/EndAlignment:
|
|
90
|
+
Exclude:
|
|
91
|
+
- 'lib/canon/diff_formatter/diff_detail_formatter/dimension_formatter.rb'
|
|
92
|
+
|
|
93
|
+
# Offense count: 5
|
|
94
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
95
|
+
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
|
96
|
+
# SupportedStyles: consistent, consistent_relative_to_receiver, special_for_inner_method_call, special_for_inner_method_call_in_parentheses
|
|
97
|
+
Layout/FirstArgumentIndentation:
|
|
98
|
+
Exclude:
|
|
99
|
+
- 'lib/canon/config/profile_loader.rb'
|
|
100
|
+
- 'lib/canon/diff/diff_classifier.rb'
|
|
101
|
+
- 'spec/canon/config/profile_loader_spec.rb'
|
|
102
|
+
|
|
103
|
+
# Offense count: 30
|
|
104
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
105
|
+
# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
|
|
106
|
+
# SupportedHashRocketStyles: key, separator, table
|
|
107
|
+
# SupportedColonStyles: key, separator, table
|
|
108
|
+
# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
|
|
109
|
+
Layout/HashAlignment:
|
|
110
|
+
Exclude:
|
|
111
|
+
- 'spec/canon/diff_formatter/diff_detail_formatter_spec.rb'
|
|
112
|
+
- 'spec/canon/diff_formatter/display_preprocessing_spec.rb'
|
|
113
|
+
- 'spec/canon/diff_formatter/pretty_diff_spec.rb'
|
|
114
|
+
- 'spec/canon/diff_formatter/show_diffs_filtering_spec.rb'
|
|
115
|
+
- 'spec/canon/pretty_printer/xml_normalized_spec.rb'
|
|
116
|
+
|
|
117
|
+
# Offense count: 36
|
|
31
118
|
# This cop supports safe autocorrection (--autocorrect).
|
|
32
119
|
# Configuration parameters: Width, EnforcedStyleAlignWith, AllowedPatterns.
|
|
33
120
|
# SupportedStylesAlignWith: start_of_line, relative_to_receiver
|
|
34
121
|
Layout/IndentationWidth:
|
|
35
122
|
Exclude:
|
|
36
|
-
- 'lib/canon/
|
|
37
|
-
- '
|
|
123
|
+
- 'lib/canon/diff_formatter/diff_detail_formatter/dimension_formatter.rb'
|
|
124
|
+
- 'lib/canon/diff_formatter/diff_detail_formatter/node_utils.rb'
|
|
125
|
+
- 'lib/canon/pretty_printer/xml_normalized.rb'
|
|
126
|
+
- 'spec/canon/config/profile_loader_spec.rb'
|
|
127
|
+
- 'spec/canon/diff_formatter/display_preprocessing_spec.rb'
|
|
128
|
+
- 'spec/canon/diff_formatter/pretty_diff_spec.rb'
|
|
129
|
+
- 'spec/canon/diff_formatter/show_diffs_filtering_spec.rb'
|
|
130
|
+
- 'spec/canon/pretty_printer/xml_normalized_spec.rb'
|
|
38
131
|
|
|
39
|
-
# Offense count:
|
|
132
|
+
# Offense count: 1375
|
|
40
133
|
# This cop supports safe autocorrection (--autocorrect).
|
|
41
134
|
# Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings.
|
|
42
135
|
# URISchemes: http, https
|
|
43
136
|
Layout/LineLength:
|
|
44
137
|
Enabled: false
|
|
45
138
|
|
|
46
|
-
# Offense count:
|
|
139
|
+
# Offense count: 2
|
|
140
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
141
|
+
# Configuration parameters: EnforcedStyle.
|
|
142
|
+
# SupportedStyles: symmetrical, new_line, same_line
|
|
143
|
+
Layout/MultilineMethodCallBraceLayout:
|
|
144
|
+
Exclude:
|
|
145
|
+
- 'lib/canon/config/profile_loader.rb'
|
|
146
|
+
- 'lib/canon/diff/diff_classifier.rb'
|
|
147
|
+
|
|
148
|
+
# Offense count: 57
|
|
149
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
150
|
+
# Configuration parameters: AllowInHeredoc.
|
|
151
|
+
Layout/TrailingWhitespace:
|
|
152
|
+
Enabled: false
|
|
153
|
+
|
|
154
|
+
# Offense count: 56
|
|
47
155
|
# Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches, IgnoreDuplicateElseBranch.
|
|
48
156
|
Lint/DuplicateBranch:
|
|
49
157
|
Enabled: false
|
|
@@ -88,7 +196,7 @@ Lint/UselessConstantScoping:
|
|
|
88
196
|
Exclude:
|
|
89
197
|
- 'lib/canon/diff_formatter/theme.rb'
|
|
90
198
|
|
|
91
|
-
# Offense count:
|
|
199
|
+
# Offense count: 309
|
|
92
200
|
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max.
|
|
93
201
|
Metrics/AbcSize:
|
|
94
202
|
Enabled: false
|
|
@@ -99,27 +207,27 @@ Metrics/AbcSize:
|
|
|
99
207
|
Metrics/BlockLength:
|
|
100
208
|
Max: 92
|
|
101
209
|
|
|
102
|
-
# Offense count:
|
|
210
|
+
# Offense count: 3
|
|
103
211
|
# Configuration parameters: CountBlocks, CountModifierForms.
|
|
104
212
|
Metrics/BlockNesting:
|
|
105
213
|
Max: 4
|
|
106
214
|
|
|
107
|
-
# Offense count:
|
|
215
|
+
# Offense count: 272
|
|
108
216
|
# Configuration parameters: AllowedMethods, AllowedPatterns, Max.
|
|
109
217
|
Metrics/CyclomaticComplexity:
|
|
110
218
|
Enabled: false
|
|
111
219
|
|
|
112
|
-
# Offense count:
|
|
220
|
+
# Offense count: 498
|
|
113
221
|
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
|
|
114
222
|
Metrics/MethodLength:
|
|
115
223
|
Max: 146
|
|
116
224
|
|
|
117
|
-
# Offense count:
|
|
225
|
+
# Offense count: 58
|
|
118
226
|
# Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
|
|
119
227
|
Metrics/ParameterLists:
|
|
120
228
|
Max: 10
|
|
121
229
|
|
|
122
|
-
# Offense count:
|
|
230
|
+
# Offense count: 219
|
|
123
231
|
# Configuration parameters: AllowedMethods, AllowedPatterns, Max.
|
|
124
232
|
Metrics/PerceivedComplexity:
|
|
125
233
|
Enabled: false
|
|
@@ -152,13 +260,13 @@ Performance/CollectionLiteralInLoop:
|
|
|
152
260
|
- 'lib/canon/xml/xml_base_handler.rb'
|
|
153
261
|
- 'spec/canon/diff/diff_node_mapper_comments_spec.rb'
|
|
154
262
|
|
|
155
|
-
# Offense count:
|
|
263
|
+
# Offense count: 82
|
|
156
264
|
# Configuration parameters: Prefixes, AllowedPatterns.
|
|
157
265
|
# Prefixes: when, with, without
|
|
158
266
|
RSpec/ContextWording:
|
|
159
267
|
Enabled: false
|
|
160
268
|
|
|
161
|
-
# Offense count:
|
|
269
|
+
# Offense count: 37
|
|
162
270
|
# Configuration parameters: IgnoredMetadata.
|
|
163
271
|
RSpec/DescribeClass:
|
|
164
272
|
Enabled: false
|
|
@@ -169,7 +277,7 @@ RSpec/DescribeMethod:
|
|
|
169
277
|
- 'spec/canon/comparison/multiple_differences_spec.rb'
|
|
170
278
|
- 'spec/canon/diff_formatter/character_map_customization_spec.rb'
|
|
171
279
|
|
|
172
|
-
# Offense count:
|
|
280
|
+
# Offense count: 804
|
|
173
281
|
# Configuration parameters: CountAsOne.
|
|
174
282
|
RSpec/ExampleLength:
|
|
175
283
|
Max: 44
|
|
@@ -183,7 +291,7 @@ RSpec/ExpectActual:
|
|
|
183
291
|
- 'spec/canon/rspec_matchers_spec.rb'
|
|
184
292
|
- 'spec/canon/string_matcher_spec.rb'
|
|
185
293
|
|
|
186
|
-
# Offense count:
|
|
294
|
+
# Offense count: 177
|
|
187
295
|
# Configuration parameters: Max, AllowedIdentifiers, AllowedPatterns.
|
|
188
296
|
RSpec/IndexedLet:
|
|
189
297
|
Exclude:
|
|
@@ -221,14 +329,14 @@ RSpec/MultipleDescribes:
|
|
|
221
329
|
Exclude:
|
|
222
330
|
- 'spec/canon/comparison/match_options_spec.rb'
|
|
223
331
|
|
|
224
|
-
# Offense count:
|
|
332
|
+
# Offense count: 654
|
|
225
333
|
RSpec/MultipleExpectations:
|
|
226
334
|
Max: 15
|
|
227
335
|
|
|
228
|
-
# Offense count:
|
|
336
|
+
# Offense count: 93
|
|
229
337
|
# Configuration parameters: AllowSubject.
|
|
230
338
|
RSpec/MultipleMemoizedHelpers:
|
|
231
|
-
Max:
|
|
339
|
+
Max: 16
|
|
232
340
|
|
|
233
341
|
# Offense count: 17
|
|
234
342
|
# Configuration parameters: EnforcedStyle, IgnoreSharedExamples.
|
|
@@ -239,7 +347,7 @@ RSpec/NamedSubject:
|
|
|
239
347
|
- 'spec/canon/pretty_printer/json_spec.rb'
|
|
240
348
|
- 'spec/canon/pretty_printer/xml_spec.rb'
|
|
241
349
|
|
|
242
|
-
# Offense count:
|
|
350
|
+
# Offense count: 50
|
|
243
351
|
# Configuration parameters: AllowedGroups.
|
|
244
352
|
RSpec/NestedGroups:
|
|
245
353
|
Max: 4
|
|
@@ -273,7 +381,7 @@ RSpec/SpecFilePathFormat:
|
|
|
273
381
|
- 'spec/canon/yaml/formatter_spec.rb'
|
|
274
382
|
- 'spec/xml_c14n_spec.rb'
|
|
275
383
|
|
|
276
|
-
# Offense count:
|
|
384
|
+
# Offense count: 131
|
|
277
385
|
# Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
|
|
278
386
|
RSpec/VerifiedDoubles:
|
|
279
387
|
Exclude:
|
|
@@ -285,7 +393,7 @@ RSpec/VerifiedDoubles:
|
|
|
285
393
|
- 'spec/canon/diff_formatter/diff_detail_formatter_spec.rb'
|
|
286
394
|
- 'spec/canon/tree_diff/operation_converter_spec.rb'
|
|
287
395
|
|
|
288
|
-
# Offense count:
|
|
396
|
+
# Offense count: 25
|
|
289
397
|
# This cop supports safe autocorrection (--autocorrect).
|
|
290
398
|
# Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, AllowedMethods, AllowedPatterns, AllowBracesOnProceduralOneLiners, BracesRequiredMethods.
|
|
291
399
|
# SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
|
|
@@ -294,8 +402,13 @@ RSpec/VerifiedDoubles:
|
|
|
294
402
|
# AllowedMethods: lambda, proc, it
|
|
295
403
|
Style/BlockDelimiters:
|
|
296
404
|
Exclude:
|
|
297
|
-
- 'lib/canon/
|
|
298
|
-
- '
|
|
405
|
+
- 'lib/canon/diff_formatter/diff_detail_formatter/node_utils.rb'
|
|
406
|
+
- 'lib/canon/pretty_printer/xml_normalized.rb'
|
|
407
|
+
- 'spec/canon/config/profile_loader_spec.rb'
|
|
408
|
+
- 'spec/canon/diff_formatter/display_preprocessing_spec.rb'
|
|
409
|
+
- 'spec/canon/diff_formatter/pretty_diff_spec.rb'
|
|
410
|
+
- 'spec/canon/diff_formatter/show_diffs_filtering_spec.rb'
|
|
411
|
+
- 'spec/canon/pretty_printer/xml_normalized_spec.rb'
|
|
299
412
|
|
|
300
413
|
# Offense count: 1
|
|
301
414
|
# This cop supports safe autocorrection (--autocorrect).
|
|
@@ -319,6 +432,18 @@ Style/IdenticalConditionalBranches:
|
|
|
319
432
|
- 'lib/canon/diff_formatter/by_object/base_formatter.rb'
|
|
320
433
|
- 'lib/canon/diff_formatter/legend.rb'
|
|
321
434
|
|
|
435
|
+
# Offense count: 3
|
|
436
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
437
|
+
Style/MultilineIfModifier:
|
|
438
|
+
Exclude:
|
|
439
|
+
- 'lib/canon/pretty_printer/xml_normalized.rb'
|
|
440
|
+
|
|
441
|
+
# Offense count: 2
|
|
442
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
443
|
+
Style/MultilineTernaryOperator:
|
|
444
|
+
Exclude:
|
|
445
|
+
- 'lib/canon/diff_formatter/diff_detail_formatter/dimension_formatter.rb'
|
|
446
|
+
|
|
322
447
|
# Offense count: 1
|
|
323
448
|
# Configuration parameters: AllowedMethods.
|
|
324
449
|
# AllowedMethods: respond_to_missing?
|
data/docs/INDEX.adoc
CHANGED
|
@@ -98,6 +98,7 @@ Choose your interface:
|
|
|
98
98
|
=== Level 4: Master Features (1 hour)
|
|
99
99
|
|
|
100
100
|
. link:features/match-options/[Match options and profiles]
|
|
101
|
+
. link:features/configuration-profiles/[Configuration profiles] - YAML-based presets with element-level whitespace control
|
|
101
102
|
. link:features/canonicalization/[Format-specific canonicalization]
|
|
102
103
|
. link:features/diff-formatting/[Customizing diff output]
|
|
103
104
|
|
|
@@ -111,6 +112,7 @@ Choose your interface:
|
|
|
111
112
|
|
|
112
113
|
* link:reference/options-across-interfaces[Options Across Interfaces] - Same options in CLI, Ruby API, and RSpec
|
|
113
114
|
* link:reference/environment-variables[Environment Variables] - Configure Canon via ENV variables
|
|
115
|
+
* link:features/configuration-profiles/[Configuration Profiles] - YAML presets with element-level whitespace control
|
|
114
116
|
* link:features/match-options/profiles[Match Profiles] - Pre-configured comparison strategies
|
|
115
117
|
* link:features/diff-formatting/colors-and-symbols[Color-Coded Diffs] - Understanding diff output
|
|
116
118
|
* link:features/environment-configuration/size-limits[Size Limits] - Preventing hangs on large files
|
|
@@ -135,5 +137,7 @@ See link:contributing[Contributing to Documentation]
|
|
|
135
137
|
* Size limits for large files
|
|
136
138
|
* Enhanced character visualization
|
|
137
139
|
* Environment variable configuration
|
|
140
|
+
* Configuration profiles with element-level whitespace classification
|
|
141
|
+
* Three-way whitespace sensitivity: strict, normalize, insensitive
|
|
138
142
|
|
|
139
143
|
See link:https://github.com/lutaml/canon/blob/main/CHANGELOG.md[Full Changelog]
|
|
@@ -324,7 +324,7 @@ html2 = '<code>indented</code><p>text</p>'
|
|
|
324
324
|
Canon::Comparison.equivalent?(html1, html2,
|
|
325
325
|
format: :html,
|
|
326
326
|
match: {
|
|
327
|
-
|
|
327
|
+
strip_whitespace_elements: [:code],
|
|
328
328
|
}
|
|
329
329
|
)
|
|
330
330
|
# => true
|
|
@@ -423,9 +423,10 @@ def classify(diff_node)
|
|
|
423
423
|
end
|
|
424
424
|
|
|
425
425
|
# SECOND: Handle content-level formatting for text_content with :normalize
|
|
426
|
+
# Skipped for :preserve elements (<pre>, <code>, etc.) where whitespace is always normative
|
|
426
427
|
if diff_node.dimension == :text_content &&
|
|
427
428
|
profile.send(:behavior_for, :text_content) == :normalize &&
|
|
428
|
-
!
|
|
429
|
+
!inside_preserve_element?(diff_node) &&
|
|
429
430
|
formatting_only_diff?(diff_node)
|
|
430
431
|
diff_node.formatting = true
|
|
431
432
|
diff_node.normative = false
|
|
@@ -130,10 +130,33 @@ Each difference displays:
|
|
|
130
130
|
* **Status indicator**: `[NORMATIVE]` (green) or `[INFORMATIVE]` (yellow)
|
|
131
131
|
* **Dimension**: Which aspect differs (colorized in magenta)
|
|
132
132
|
* **Location**: XPath for XML/HTML, path for JSON/YAML (colorized in blue)
|
|
133
|
+
* **Reason**: When the reason contains visualized whitespace characters (░),
|
|
134
|
+
it is split across two lines with the before and after text vertically
|
|
135
|
+
aligned for easier visual comparison:
|
|
136
|
+
+
|
|
137
|
+
[source]
|
|
138
|
+
----
|
|
139
|
+
Reason: Text: "░░term2░definition░░"
|
|
140
|
+
vs.: "░term2░definition░"
|
|
141
|
+
----
|
|
142
|
+
+
|
|
143
|
+
When no visualized whitespace is present, the reason remains a single line.
|
|
133
144
|
* **Expected section**: What was in File 1 (red heading, bold)
|
|
134
145
|
* **Actual section**: What was in File 2 (green heading, bold)
|
|
135
146
|
* **Changes summary**: Actionable description of the difference (yellow, bold)
|
|
136
147
|
|
|
148
|
+
When both the Expected and Actual values are short (under 30 characters), they
|
|
149
|
+
are rendered as compact single lines with aligned colons for succinctness:
|
|
150
|
+
|
|
151
|
+
[source]
|
|
152
|
+
----
|
|
153
|
+
⊖ Expected (File 1): "term2 definition"
|
|
154
|
+
⊕ Actual (File 2) : "term2 definition"
|
|
155
|
+
----
|
|
156
|
+
|
|
157
|
+
For longer values, they appear on separate lines with no blank line between
|
|
158
|
+
them.
|
|
159
|
+
|
|
137
160
|
=== Dimension-specific formats
|
|
138
161
|
|
|
139
162
|
==== Attribute presence differences
|