svg_conform 0.1.1 → 0.1.3
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 +437 -14
- data/README.adoc +62 -8
- data/examples/readme_usage.rb +67 -0
- data/examples/requirements_demo.rb +4 -4
- data/lib/svg_conform/document.rb +7 -1
- data/lib/svg_conform/element_proxy.rb +101 -0
- data/lib/svg_conform/fast_document_analyzer.rb +82 -0
- data/lib/svg_conform/node_index_builder.rb +48 -0
- data/lib/svg_conform/requirements/allowed_elements_requirement.rb +222 -0
- data/lib/svg_conform/requirements/base_requirement.rb +27 -0
- data/lib/svg_conform/requirements/color_restrictions_requirement.rb +55 -0
- data/lib/svg_conform/requirements/font_family_requirement.rb +22 -0
- data/lib/svg_conform/requirements/forbidden_content_requirement.rb +26 -0
- data/lib/svg_conform/requirements/id_reference_requirement.rb +99 -0
- data/lib/svg_conform/requirements/invalid_id_references_requirement.rb +92 -0
- data/lib/svg_conform/requirements/link_validation_requirement.rb +30 -0
- data/lib/svg_conform/requirements/namespace_attributes_requirement.rb +65 -0
- data/lib/svg_conform/requirements/namespace_requirement.rb +75 -0
- data/lib/svg_conform/requirements/no_external_css_requirement.rb +74 -0
- data/lib/svg_conform/requirements/no_external_fonts_requirement.rb +58 -0
- data/lib/svg_conform/requirements/no_external_images_requirement.rb +40 -0
- data/lib/svg_conform/requirements/style_promotion_requirement.rb +7 -0
- data/lib/svg_conform/requirements/style_requirement.rb +12 -0
- data/lib/svg_conform/requirements/viewbox_required_requirement.rb +72 -0
- data/lib/svg_conform/sax_document.rb +46 -0
- data/lib/svg_conform/sax_validation_handler.rb +162 -0
- data/lib/svg_conform/validation_context.rb +87 -3
- data/lib/svg_conform/validator.rb +73 -5
- data/lib/svg_conform/version.rb +1 -1
- data/lib/svg_conform.rb +1 -0
- data/spec/spec_helper.rb +3 -0
- data/spec/support/shared_examples_for_validation_modes.rb +71 -0
- metadata +9 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c862af872ab16b243d9f6ffaedb7c5a37e8c470a5280915cc96bc33a3572c8e5
|
|
4
|
+
data.tar.gz: 3b5fbeebd207eb29ac9685a8913799cc8239704566d9efd8b18fa663bf55a8d0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d5808529cca60d31e717f907c5fa9cf11753fb7de4bb65416f7a796f007b4a0157f35c28a7c40f7d58a089eb83738ffc16237e60856b6dd54e475db12132ea91
|
|
7
|
+
data.tar.gz: e597d1400a180a30a44ce26437f84bdc4fc8d51d6c7e0e7aa5afdf2adefa8c1c7ad1bd749c613fb9c7635d1fa462993d345866f17775671e5b2b687042778196
|
data/.rubocop_todo.yml
CHANGED
|
@@ -1,26 +1,214 @@
|
|
|
1
1
|
# This configuration was generated by
|
|
2
2
|
# `rubocop --auto-gen-config`
|
|
3
|
-
# on 2025-
|
|
3
|
+
# on 2025-11-19 09:35:14 UTC using RuboCop version 1.81.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:
|
|
9
|
+
# Offense count: 19
|
|
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
|
+
- 'compare_dom_sax.rb'
|
|
16
|
+
- 'lib/svg_conform/requirements/font_family_requirement.rb'
|
|
17
|
+
- 'lib/svg_conform/requirements/namespace_attributes_requirement.rb'
|
|
18
|
+
- 'lib/svg_conform/sax_validation_handler.rb'
|
|
19
|
+
- 'spec/support/shared_examples_for_validation_modes.rb'
|
|
20
|
+
|
|
21
|
+
# Offense count: 5
|
|
22
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
23
|
+
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
|
24
|
+
# SupportedStyles: with_first_element, with_fixed_indentation
|
|
25
|
+
Layout/ArrayAlignment:
|
|
26
|
+
Exclude:
|
|
27
|
+
- 'lib/svg_conform/requirements/color_restrictions_requirement.rb'
|
|
28
|
+
- 'lib/svg_conform/requirements/id_reference_requirement.rb'
|
|
29
|
+
- 'lib/svg_conform/requirements/invalid_id_references_requirement.rb'
|
|
30
|
+
|
|
31
|
+
# Offense count: 5
|
|
10
32
|
# This cop supports safe autocorrection (--autocorrect).
|
|
11
33
|
# Configuration parameters: EnforcedStyleAlignWith.
|
|
12
34
|
# SupportedStylesAlignWith: either, start_of_block, start_of_line
|
|
13
35
|
Layout/BlockAlignment:
|
|
14
36
|
Exclude:
|
|
37
|
+
- 'benchmark_bsi_samples.rb'
|
|
38
|
+
- 'check_position_collisions.rb'
|
|
39
|
+
- 'check_unique_positions.rb'
|
|
40
|
+
- 'lib/svg_conform/requirements/allowed_elements_requirement.rb'
|
|
15
41
|
- 'spec/svg_conform/profiles/svg_1_2_rfc_profile_spec.rb'
|
|
16
42
|
|
|
17
|
-
# Offense count:
|
|
43
|
+
# Offense count: 8
|
|
44
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
45
|
+
Layout/BlockEndNewline:
|
|
46
|
+
Exclude:
|
|
47
|
+
- 'benchmark_bsi_samples.rb'
|
|
48
|
+
- 'check_duplicates.rb'
|
|
49
|
+
- 'check_position_collisions.rb'
|
|
50
|
+
- 'check_unique_positions.rb'
|
|
51
|
+
- 'compare_errors.rb'
|
|
52
|
+
- 'find_missing_errors.rb'
|
|
53
|
+
- 'lib/svg_conform/requirements/allowed_elements_requirement.rb'
|
|
54
|
+
|
|
55
|
+
# Offense count: 4
|
|
56
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
57
|
+
# Configuration parameters: AllowForAlignment.
|
|
58
|
+
Layout/CommentIndentation:
|
|
59
|
+
Exclude:
|
|
60
|
+
- 'lib/svg_conform/requirements/namespace_attributes_requirement.rb'
|
|
61
|
+
- 'lib/svg_conform/validation_context.rb'
|
|
62
|
+
|
|
63
|
+
# Offense count: 2
|
|
64
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
65
|
+
Layout/ElseAlignment:
|
|
66
|
+
Exclude:
|
|
67
|
+
- 'lib/svg_conform/requirements/namespace_attributes_requirement.rb'
|
|
68
|
+
|
|
69
|
+
# Offense count: 17
|
|
70
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
71
|
+
Layout/EmptyLineAfterGuardClause:
|
|
72
|
+
Exclude:
|
|
73
|
+
- 'analyze_error_nodes.rb'
|
|
74
|
+
- 'check_duplicates.rb'
|
|
75
|
+
- 'check_position_collisions.rb'
|
|
76
|
+
- 'check_unique_positions.rb'
|
|
77
|
+
- 'compare_errors.rb'
|
|
78
|
+
- 'debug_object_ids.rb'
|
|
79
|
+
- 'debug_utf8.rb'
|
|
80
|
+
- 'find_all_elements.rb'
|
|
81
|
+
- 'find_missing_errors.rb'
|
|
82
|
+
- 'lib/svg_conform/fast_document_analyzer.rb'
|
|
83
|
+
- 'lib/svg_conform/node_index_builder.rb'
|
|
84
|
+
- 'lib/svg_conform/requirements/id_reference_requirement.rb'
|
|
85
|
+
- 'lib/svg_conform/sax_validation_handler.rb'
|
|
86
|
+
|
|
87
|
+
# Offense count: 1
|
|
88
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
89
|
+
# Configuration parameters: EmptyLineBetweenMethodDefs, EmptyLineBetweenClassDefs, EmptyLineBetweenModuleDefs, DefLikeMacros, AllowAdjacentOneLineDefs, NumberOfEmptyLines.
|
|
90
|
+
Layout/EmptyLineBetweenDefs:
|
|
91
|
+
Exclude:
|
|
92
|
+
- 'lib/svg_conform/requirements/namespace_attributes_requirement.rb'
|
|
93
|
+
|
|
94
|
+
# Offense count: 1
|
|
95
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
96
|
+
Layout/EmptyLines:
|
|
97
|
+
Exclude:
|
|
98
|
+
- 'lib/svg_conform/requirements/namespace_attributes_requirement.rb'
|
|
99
|
+
|
|
100
|
+
# Offense count: 1
|
|
101
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
102
|
+
Layout/EmptyLinesAroundMethodBody:
|
|
103
|
+
Exclude:
|
|
104
|
+
- 'lib/svg_conform/fast_document_analyzer.rb'
|
|
105
|
+
|
|
106
|
+
# Offense count: 2
|
|
107
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
108
|
+
# Configuration parameters: EnforcedStyleAlignWith, Severity.
|
|
109
|
+
# SupportedStylesAlignWith: keyword, variable, start_of_line
|
|
110
|
+
Layout/EndAlignment:
|
|
111
|
+
Exclude:
|
|
112
|
+
- 'lib/svg_conform/requirements/namespace_attributes_requirement.rb'
|
|
113
|
+
|
|
114
|
+
# Offense count: 22
|
|
115
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
116
|
+
# Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment.
|
|
117
|
+
Layout/ExtraSpacing:
|
|
118
|
+
Exclude:
|
|
119
|
+
- 'benchmark_bsi_samples.rb'
|
|
120
|
+
- 'find_missing_errors.rb'
|
|
121
|
+
- 'lib/svg_conform/element_proxy.rb'
|
|
122
|
+
- 'lib/svg_conform/requirements/id_reference_requirement.rb'
|
|
123
|
+
- 'lib/svg_conform/requirements/invalid_id_references_requirement.rb'
|
|
124
|
+
- 'lib/svg_conform/sax_validation_handler.rb'
|
|
125
|
+
- 'lib/svg_conform/validation_context.rb'
|
|
126
|
+
- 'lib/svg_conform/validator.rb'
|
|
127
|
+
|
|
128
|
+
# Offense count: 2
|
|
129
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
130
|
+
# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
|
|
131
|
+
# SupportedHashRocketStyles: key, separator, table
|
|
132
|
+
# SupportedColonStyles: key, separator, table
|
|
133
|
+
# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
|
|
134
|
+
Layout/HashAlignment:
|
|
135
|
+
Exclude:
|
|
136
|
+
- 'benchmark_bsi_samples.rb'
|
|
137
|
+
- 'final_demo.rb'
|
|
138
|
+
|
|
139
|
+
# Offense count: 2
|
|
140
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
141
|
+
Layout/HeredocIndentation:
|
|
142
|
+
Exclude:
|
|
143
|
+
- 'test_sax_basic.rb'
|
|
144
|
+
|
|
145
|
+
# Offense count: 8
|
|
146
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
147
|
+
# Configuration parameters: EnforcedStyle.
|
|
148
|
+
# SupportedStyles: normal, indented_internal_methods
|
|
149
|
+
Layout/IndentationConsistency:
|
|
150
|
+
Exclude:
|
|
151
|
+
- 'check_duplicates.rb'
|
|
152
|
+
- 'compare_dom_sax.rb'
|
|
153
|
+
- 'compare_errors.rb'
|
|
154
|
+
- 'find_missing_errors.rb'
|
|
155
|
+
- 'lib/svg_conform/validation_context.rb'
|
|
156
|
+
|
|
157
|
+
# Offense count: 13
|
|
158
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
159
|
+
# Configuration parameters: Width, AllowedPatterns.
|
|
160
|
+
Layout/IndentationWidth:
|
|
161
|
+
Exclude:
|
|
162
|
+
- 'benchmark_bsi_samples.rb'
|
|
163
|
+
- 'check_position_collisions.rb'
|
|
164
|
+
- 'check_unique_positions.rb'
|
|
165
|
+
- 'lib/svg_conform/requirements/allowed_elements_requirement.rb'
|
|
166
|
+
- 'lib/svg_conform/requirements/namespace_attributes_requirement.rb'
|
|
167
|
+
|
|
168
|
+
# Offense count: 640
|
|
18
169
|
# This cop supports safe autocorrection (--autocorrect).
|
|
19
170
|
# Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings.
|
|
20
171
|
# URISchemes: http, https
|
|
21
172
|
Layout/LineLength:
|
|
22
173
|
Enabled: false
|
|
23
174
|
|
|
175
|
+
# Offense count: 3
|
|
176
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
177
|
+
Layout/MultilineBlockLayout:
|
|
178
|
+
Exclude:
|
|
179
|
+
- 'check_duplicates.rb'
|
|
180
|
+
- 'compare_errors.rb'
|
|
181
|
+
- 'find_missing_errors.rb'
|
|
182
|
+
|
|
183
|
+
# Offense count: 28
|
|
184
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
185
|
+
# Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator, EnforcedStyleForRationalLiterals.
|
|
186
|
+
# SupportedStylesForExponentOperator: space, no_space
|
|
187
|
+
# SupportedStylesForRationalLiterals: space, no_space
|
|
188
|
+
Layout/SpaceAroundOperators:
|
|
189
|
+
Exclude:
|
|
190
|
+
- 'benchmark_sax.rb'
|
|
191
|
+
- 'benchmark_validation.rb'
|
|
192
|
+
- 'check_clippath_font.rb'
|
|
193
|
+
- 'check_unique_positions.rb'
|
|
194
|
+
- 'count_elements.rb'
|
|
195
|
+
- 'final_demo.rb'
|
|
196
|
+
- 'test_remediation.rb'
|
|
197
|
+
|
|
198
|
+
# Offense count: 1
|
|
199
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
200
|
+
# Configuration parameters: EnforcedStyle.
|
|
201
|
+
# SupportedStyles: final_newline, final_blank_line
|
|
202
|
+
Layout/TrailingEmptyLines:
|
|
203
|
+
Exclude:
|
|
204
|
+
- 'spec/support/shared_examples_for_validation_modes.rb'
|
|
205
|
+
|
|
206
|
+
# Offense count: 67
|
|
207
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
208
|
+
# Configuration parameters: AllowInHeredoc.
|
|
209
|
+
Layout/TrailingWhitespace:
|
|
210
|
+
Enabled: false
|
|
211
|
+
|
|
24
212
|
# Offense count: 2
|
|
25
213
|
# Configuration parameters: AllowedMethods.
|
|
26
214
|
# AllowedMethods: enums
|
|
@@ -28,7 +216,7 @@ Lint/ConstantDefinitionInBlock:
|
|
|
28
216
|
Exclude:
|
|
29
217
|
- 'spec/svg_conform/profiles/svg_1_2_rfc_profile_spec.rb'
|
|
30
218
|
|
|
31
|
-
# Offense count:
|
|
219
|
+
# Offense count: 19
|
|
32
220
|
# Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches, IgnoreDuplicateElseBranch.
|
|
33
221
|
Lint/DuplicateBranch:
|
|
34
222
|
Exclude:
|
|
@@ -38,51 +226,94 @@ Lint/DuplicateBranch:
|
|
|
38
226
|
- 'lib/svg_conform/semantic_comparator.rb'
|
|
39
227
|
- 'lib/svg_conform/validation_context.rb'
|
|
40
228
|
- 'lib/svg_conform/validation_result.rb'
|
|
229
|
+
- 'lib/svg_conform/validator.rb'
|
|
41
230
|
|
|
42
231
|
# Offense count: 2
|
|
43
232
|
Lint/DuplicateCaseCondition:
|
|
44
233
|
Exclude:
|
|
45
234
|
- 'lib/svg_conform/semantic_comparator.rb'
|
|
46
235
|
|
|
47
|
-
# Offense count:
|
|
236
|
+
# Offense count: 2
|
|
48
237
|
Lint/DuplicateMethods:
|
|
49
238
|
Exclude:
|
|
239
|
+
- 'lib/svg_conform/sax_validation_handler.rb'
|
|
50
240
|
- 'lib/svg_conform/validation_context.rb'
|
|
51
241
|
|
|
52
|
-
# Offense count:
|
|
242
|
+
# Offense count: 1
|
|
243
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
244
|
+
Lint/IdentityComparison:
|
|
245
|
+
Exclude:
|
|
246
|
+
- 'lib/svg_conform/fast_document_analyzer.rb'
|
|
247
|
+
|
|
248
|
+
# Offense count: 4
|
|
53
249
|
# Configuration parameters: AllowedParentClasses.
|
|
54
250
|
Lint/MissingSuper:
|
|
55
251
|
Exclude:
|
|
56
252
|
- 'lib/svg_conform/compatibility/pattern_discovery.rb'
|
|
57
253
|
- 'lib/svg_conform/compatibility/validity_analysis.rb'
|
|
254
|
+
- 'lib/svg_conform/sax_validation_handler.rb'
|
|
255
|
+
|
|
256
|
+
# Offense count: 3
|
|
257
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
258
|
+
# Configuration parameters: AllowedMethods, InferNonNilReceiver, AdditionalNilMethods.
|
|
259
|
+
# AllowedMethods: instance_of?, kind_of?, is_a?, eql?, respond_to?, equal?
|
|
260
|
+
# AdditionalNilMethods: present?, blank?, try, try!
|
|
261
|
+
Lint/RedundantSafeNavigation:
|
|
262
|
+
Exclude:
|
|
263
|
+
- 'count_elements.rb'
|
|
264
|
+
- 'lib/svg_conform/fast_document_analyzer.rb'
|
|
265
|
+
|
|
266
|
+
# Offense count: 1
|
|
267
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
268
|
+
Lint/RedundantStringCoercion:
|
|
269
|
+
Exclude:
|
|
270
|
+
- 'analyze_error_nodes.rb'
|
|
58
271
|
|
|
59
272
|
# Offense count: 1
|
|
60
273
|
Lint/UnreachableCode:
|
|
61
274
|
Exclude:
|
|
62
275
|
- 'lib/svg_conform/commands/check.rb'
|
|
63
276
|
|
|
64
|
-
# Offense count:
|
|
277
|
+
# Offense count: 4
|
|
278
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
279
|
+
# Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods, NotImplementedExceptions.
|
|
280
|
+
# NotImplementedExceptions: NotImplementedError
|
|
281
|
+
Lint/UnusedMethodArgument:
|
|
282
|
+
Exclude:
|
|
283
|
+
- 'lib/svg_conform/element_proxy.rb'
|
|
284
|
+
- 'lib/svg_conform/requirements/id_reference_requirement.rb'
|
|
285
|
+
- 'lib/svg_conform/requirements/invalid_id_references_requirement.rb'
|
|
286
|
+
- 'lib/svg_conform/sax_validation_handler.rb'
|
|
287
|
+
|
|
288
|
+
# Offense count: 1
|
|
289
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
290
|
+
# Configuration parameters: ContextCreatingMethods, MethodCreatingMethods.
|
|
291
|
+
Lint/UselessAccessModifier:
|
|
292
|
+
Exclude:
|
|
293
|
+
- 'lib/svg_conform/requirements/namespace_attributes_requirement.rb'
|
|
294
|
+
|
|
295
|
+
# Offense count: 147
|
|
65
296
|
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max.
|
|
66
297
|
Metrics/AbcSize:
|
|
67
298
|
Enabled: false
|
|
68
299
|
|
|
69
|
-
# Offense count:
|
|
300
|
+
# Offense count: 22
|
|
70
301
|
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns, inherit_mode.
|
|
71
302
|
# AllowedMethods: refine
|
|
72
303
|
Metrics/BlockLength:
|
|
73
304
|
Max: 253
|
|
74
305
|
|
|
75
|
-
# Offense count:
|
|
306
|
+
# Offense count: 8
|
|
76
307
|
# Configuration parameters: CountBlocks, CountModifierForms.
|
|
77
308
|
Metrics/BlockNesting:
|
|
78
309
|
Max: 4
|
|
79
310
|
|
|
80
|
-
# Offense count:
|
|
311
|
+
# Offense count: 126
|
|
81
312
|
# Configuration parameters: AllowedMethods, AllowedPatterns, Max.
|
|
82
313
|
Metrics/CyclomaticComplexity:
|
|
83
314
|
Enabled: false
|
|
84
315
|
|
|
85
|
-
# Offense count:
|
|
316
|
+
# Offense count: 258
|
|
86
317
|
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
|
|
87
318
|
Metrics/MethodLength:
|
|
88
319
|
Max: 154
|
|
@@ -92,11 +323,18 @@ Metrics/MethodLength:
|
|
|
92
323
|
Metrics/ParameterLists:
|
|
93
324
|
Max: 9
|
|
94
325
|
|
|
95
|
-
# Offense count:
|
|
326
|
+
# Offense count: 101
|
|
96
327
|
# Configuration parameters: AllowedMethods, AllowedPatterns, Max.
|
|
97
328
|
Metrics/PerceivedComplexity:
|
|
98
329
|
Enabled: false
|
|
99
330
|
|
|
331
|
+
# Offense count: 4
|
|
332
|
+
# Configuration parameters: EnforcedStyle, AllowedIdentifiers, AllowedPatterns, ForbiddenIdentifiers, ForbiddenPatterns.
|
|
333
|
+
# SupportedStyles: snake_case, camelCase
|
|
334
|
+
Naming/VariableName:
|
|
335
|
+
Exclude:
|
|
336
|
+
- 'check_clippath_font.rb'
|
|
337
|
+
|
|
100
338
|
# Offense count: 2
|
|
101
339
|
# Configuration parameters: MinSize.
|
|
102
340
|
Performance/CollectionLiteralInLoop:
|
|
@@ -104,6 +342,12 @@ Performance/CollectionLiteralInLoop:
|
|
|
104
342
|
- 'lib/svg_conform/batch_report.rb'
|
|
105
343
|
- 'lib/svg_conform/compatibility/pattern_discovery.rb'
|
|
106
344
|
|
|
345
|
+
# Offense count: 1
|
|
346
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
347
|
+
Performance/UnfreezeString:
|
|
348
|
+
Exclude:
|
|
349
|
+
- 'lib/svg_conform/element_proxy.rb'
|
|
350
|
+
|
|
107
351
|
# Offense count: 8
|
|
108
352
|
# Configuration parameters: IgnoredMetadata.
|
|
109
353
|
RSpec/DescribeClass:
|
|
@@ -122,7 +366,7 @@ RSpec/DescribeClass:
|
|
|
122
366
|
- 'spec/svg_conform/profiles/svg_1_2_rfc_with_rdf_profile_spec.rb'
|
|
123
367
|
- 'spec/svgcheck_compatibility_spec.rb'
|
|
124
368
|
|
|
125
|
-
# Offense count:
|
|
369
|
+
# Offense count: 109
|
|
126
370
|
# Configuration parameters: CountAsOne.
|
|
127
371
|
RSpec/ExampleLength:
|
|
128
372
|
Max: 53
|
|
@@ -137,7 +381,7 @@ RSpec/MultipleDescribes:
|
|
|
137
381
|
Exclude:
|
|
138
382
|
- 'spec/svg_conform/batch_report_spec.rb'
|
|
139
383
|
|
|
140
|
-
# Offense count:
|
|
384
|
+
# Offense count: 73
|
|
141
385
|
RSpec/MultipleExpectations:
|
|
142
386
|
Max: 6
|
|
143
387
|
|
|
@@ -146,6 +390,31 @@ Rake/MethodDefinitionInTask:
|
|
|
146
390
|
Exclude:
|
|
147
391
|
- 'lib/tasks/svgcheck.rake'
|
|
148
392
|
|
|
393
|
+
# Offense count: 9
|
|
394
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
395
|
+
# Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, AllowedMethods, AllowedPatterns, AllowBracesOnProceduralOneLiners, BracesRequiredMethods.
|
|
396
|
+
# SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
|
|
397
|
+
# ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
|
|
398
|
+
# FunctionalMethods: let, let!, subject, watch
|
|
399
|
+
# AllowedMethods: lambda, proc, it
|
|
400
|
+
Style/BlockDelimiters:
|
|
401
|
+
Exclude:
|
|
402
|
+
- 'benchmark_bsi_samples.rb'
|
|
403
|
+
- 'check_duplicates.rb'
|
|
404
|
+
- 'check_position_collisions.rb'
|
|
405
|
+
- 'check_unique_positions.rb'
|
|
406
|
+
- 'compare_errors.rb'
|
|
407
|
+
- 'find_missing_errors.rb'
|
|
408
|
+
- 'lib/svg_conform/requirements/allowed_elements_requirement.rb'
|
|
409
|
+
|
|
410
|
+
# Offense count: 3
|
|
411
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
412
|
+
Style/CombinableLoops:
|
|
413
|
+
Exclude:
|
|
414
|
+
- 'check_duplicates.rb'
|
|
415
|
+
- 'compare_errors.rb'
|
|
416
|
+
- 'find_missing_errors.rb'
|
|
417
|
+
|
|
149
418
|
# Offense count: 2
|
|
150
419
|
# This cop supports safe autocorrection (--autocorrect).
|
|
151
420
|
# Configuration parameters: EnforcedStyle, AllowComments.
|
|
@@ -167,6 +436,42 @@ Style/MissingRespondToMissing:
|
|
|
167
436
|
Exclude:
|
|
168
437
|
- 'lib/svg_conform/cli.rb'
|
|
169
438
|
|
|
439
|
+
# Offense count: 3
|
|
440
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
441
|
+
Style/MultilineIfModifier:
|
|
442
|
+
Exclude:
|
|
443
|
+
- 'benchmark_bsi_samples.rb'
|
|
444
|
+
- 'lib/svg_conform/sax_validation_handler.rb'
|
|
445
|
+
|
|
446
|
+
# Offense count: 1
|
|
447
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
448
|
+
Style/MultilineTernaryOperator:
|
|
449
|
+
Exclude:
|
|
450
|
+
- 'lib/svg_conform/requirements/namespace_attributes_requirement.rb'
|
|
451
|
+
|
|
452
|
+
# Offense count: 2
|
|
453
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
454
|
+
# Configuration parameters: EnforcedStyle.
|
|
455
|
+
# SupportedStyles: literals, strict
|
|
456
|
+
Style/MutableConstant:
|
|
457
|
+
Exclude:
|
|
458
|
+
- 'benchmark_bsi_samples.rb'
|
|
459
|
+
- 'test_sax_on_slow_files.rb'
|
|
460
|
+
|
|
461
|
+
# Offense count: 8
|
|
462
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
463
|
+
# Configuration parameters: EnforcedStyle, AllowedMethods, AllowedPatterns.
|
|
464
|
+
# SupportedStyles: predicate, comparison
|
|
465
|
+
Style/NumericPredicate:
|
|
466
|
+
Exclude:
|
|
467
|
+
- 'spec/**/*'
|
|
468
|
+
- 'benchmark_validation.rb'
|
|
469
|
+
- 'check_unique_positions.rb'
|
|
470
|
+
- 'compare_dom_sax.rb'
|
|
471
|
+
- 'lib/svg_conform/validation_context.rb'
|
|
472
|
+
- 'test_remediation.rb'
|
|
473
|
+
- 'test_sax_basic.rb'
|
|
474
|
+
|
|
170
475
|
# Offense count: 4
|
|
171
476
|
# Configuration parameters: AllowedMethods.
|
|
172
477
|
# AllowedMethods: respond_to_missing?
|
|
@@ -174,6 +479,12 @@ Style/OptionalBooleanParameter:
|
|
|
174
479
|
Exclude:
|
|
175
480
|
- 'lib/svg_conform/semantic_comparator.rb'
|
|
176
481
|
|
|
482
|
+
# Offense count: 1
|
|
483
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
484
|
+
Style/RedundantAssignment:
|
|
485
|
+
Exclude:
|
|
486
|
+
- 'lib/svg_conform/fast_document_analyzer.rb'
|
|
487
|
+
|
|
177
488
|
# Offense count: 1
|
|
178
489
|
# This cop supports safe autocorrection (--autocorrect).
|
|
179
490
|
# Configuration parameters: AllowedMethods.
|
|
@@ -181,3 +492,115 @@ Style/OptionalBooleanParameter:
|
|
|
181
492
|
Style/RedundantCondition:
|
|
182
493
|
Exclude:
|
|
183
494
|
- 'lib/svg_conform/external_checkers/svgcheck/parser.rb'
|
|
495
|
+
|
|
496
|
+
# Offense count: 1
|
|
497
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
498
|
+
Style/RedundantInterpolation:
|
|
499
|
+
Exclude:
|
|
500
|
+
- 'analyze_error_nodes.rb'
|
|
501
|
+
|
|
502
|
+
# Offense count: 1
|
|
503
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
504
|
+
Style/RedundantParentheses:
|
|
505
|
+
Exclude:
|
|
506
|
+
- 'compare_dom_sax.rb'
|
|
507
|
+
|
|
508
|
+
# Offense count: 2
|
|
509
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
510
|
+
# Configuration parameters: EnforcedStyle.
|
|
511
|
+
# SupportedStyles: implicit, explicit
|
|
512
|
+
Style/RescueStandardError:
|
|
513
|
+
Exclude:
|
|
514
|
+
- 'debug_node_coverage.rb'
|
|
515
|
+
- 'test_sax_basic.rb'
|
|
516
|
+
|
|
517
|
+
# Offense count: 3
|
|
518
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
519
|
+
# Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods, MaxChainLength.
|
|
520
|
+
# AllowedMethods: present?, blank?, presence, try, try!
|
|
521
|
+
Style/SafeNavigation:
|
|
522
|
+
Exclude:
|
|
523
|
+
- 'count_elements.rb'
|
|
524
|
+
- 'lib/svg_conform/fast_document_analyzer.rb'
|
|
525
|
+
|
|
526
|
+
# Offense count: 7
|
|
527
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
528
|
+
# Configuration parameters: Mode.
|
|
529
|
+
Style/StringConcatenation:
|
|
530
|
+
Exclude:
|
|
531
|
+
- 'benchmark_bsi_samples.rb'
|
|
532
|
+
- 'benchmark_sax.rb'
|
|
533
|
+
- 'benchmark_validation.rb'
|
|
534
|
+
- 'final_demo.rb'
|
|
535
|
+
- 'test_remediation.rb'
|
|
536
|
+
|
|
537
|
+
# Offense count: 105
|
|
538
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
539
|
+
# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
|
|
540
|
+
# SupportedStyles: single_quotes, double_quotes
|
|
541
|
+
Style/StringLiterals:
|
|
542
|
+
Enabled: false
|
|
543
|
+
|
|
544
|
+
# Offense count: 5
|
|
545
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
546
|
+
# Configuration parameters: EnforcedStyle.
|
|
547
|
+
# SupportedStyles: single_quotes, double_quotes
|
|
548
|
+
Style/StringLiteralsInInterpolation:
|
|
549
|
+
Exclude:
|
|
550
|
+
- 'benchmark_bsi_samples.rb'
|
|
551
|
+
- 'benchmark_sax.rb'
|
|
552
|
+
- 'benchmark_validation.rb'
|
|
553
|
+
- 'final_demo.rb'
|
|
554
|
+
- 'test_remediation.rb'
|
|
555
|
+
|
|
556
|
+
# Offense count: 34
|
|
557
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
558
|
+
# Configuration parameters: EnforcedStyleForMultiline.
|
|
559
|
+
# SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma
|
|
560
|
+
Style/TrailingCommaInArguments:
|
|
561
|
+
Exclude:
|
|
562
|
+
- 'lib/svg_conform/requirements/allowed_elements_requirement.rb'
|
|
563
|
+
- 'lib/svg_conform/requirements/color_restrictions_requirement.rb'
|
|
564
|
+
- 'lib/svg_conform/requirements/font_family_requirement.rb'
|
|
565
|
+
- 'lib/svg_conform/requirements/forbidden_content_requirement.rb'
|
|
566
|
+
- 'lib/svg_conform/requirements/id_reference_requirement.rb'
|
|
567
|
+
- 'lib/svg_conform/requirements/invalid_id_references_requirement.rb'
|
|
568
|
+
- 'lib/svg_conform/requirements/link_validation_requirement.rb'
|
|
569
|
+
- 'lib/svg_conform/requirements/namespace_attributes_requirement.rb'
|
|
570
|
+
- 'lib/svg_conform/requirements/namespace_requirement.rb'
|
|
571
|
+
- 'lib/svg_conform/requirements/no_external_css_requirement.rb'
|
|
572
|
+
- 'lib/svg_conform/requirements/no_external_fonts_requirement.rb'
|
|
573
|
+
- 'lib/svg_conform/requirements/no_external_images_requirement.rb'
|
|
574
|
+
- 'lib/svg_conform/requirements/viewbox_required_requirement.rb'
|
|
575
|
+
- 'lib/svg_conform/sax_validation_handler.rb'
|
|
576
|
+
- 'lib/svg_conform/validator.rb'
|
|
577
|
+
|
|
578
|
+
# Offense count: 1
|
|
579
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
580
|
+
# Configuration parameters: EnforcedStyleForMultiline.
|
|
581
|
+
# SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma
|
|
582
|
+
Style/TrailingCommaInArrayLiteral:
|
|
583
|
+
Exclude:
|
|
584
|
+
- 'test_sax_on_slow_files.rb'
|
|
585
|
+
|
|
586
|
+
# Offense count: 12
|
|
587
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
588
|
+
# Configuration parameters: EnforcedStyleForMultiline.
|
|
589
|
+
# SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma
|
|
590
|
+
Style/TrailingCommaInHashLiteral:
|
|
591
|
+
Exclude:
|
|
592
|
+
- 'debug_positions.rb'
|
|
593
|
+
- 'lib/svg_conform/requirements/allowed_elements_requirement.rb'
|
|
594
|
+
- 'lib/svg_conform/requirements/color_restrictions_requirement.rb'
|
|
595
|
+
- 'lib/svg_conform/requirements/namespace_requirement.rb'
|
|
596
|
+
- 'lib/svg_conform/requirements/viewbox_required_requirement.rb'
|
|
597
|
+
- 'lib/svg_conform/validator.rb'
|
|
598
|
+
|
|
599
|
+
# Offense count: 4
|
|
600
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
601
|
+
Style/ZeroLengthPredicate:
|
|
602
|
+
Exclude:
|
|
603
|
+
- 'benchmark_validation.rb'
|
|
604
|
+
- 'lib/svg_conform/validation_context.rb'
|
|
605
|
+
- 'test_remediation.rb'
|
|
606
|
+
- 'test_sax_basic.rb'
|
data/README.adoc
CHANGED
|
@@ -212,7 +212,7 @@ Details and examples of Ruby API usage can be found in
|
|
|
212
212
|
require 'svg_conform'
|
|
213
213
|
|
|
214
214
|
# Load a profile and validate
|
|
215
|
-
profile = SvgConform::
|
|
215
|
+
profile = SvgConform::Profiles.get(:svg_1_2_rfc)
|
|
216
216
|
document = SvgConform::Document.new(svg_content)
|
|
217
217
|
result = profile.validate(document)
|
|
218
218
|
|
|
@@ -221,11 +221,10 @@ puts "Errors: #{result.errors.count}"
|
|
|
221
221
|
puts "Warnings: #{result.warnings.count}"
|
|
222
222
|
|
|
223
223
|
# Apply remediations to fix issues
|
|
224
|
-
if !result.valid? && profile.
|
|
225
|
-
|
|
226
|
-
remediation_results = engine.apply_remediations(document, result)
|
|
224
|
+
if !result.valid? && profile.remediation_count > 0
|
|
225
|
+
changes = profile.apply_remediations(document)
|
|
227
226
|
|
|
228
|
-
puts "Applied #{
|
|
227
|
+
puts "Applied #{changes.length} remediations"
|
|
229
228
|
puts "Fixed SVG:"
|
|
230
229
|
puts document.to_xml
|
|
231
230
|
end
|
|
@@ -1026,9 +1025,9 @@ document = SvgConform::Document.new(svg_content)
|
|
|
1026
1025
|
result = profile.validate(document)
|
|
1027
1026
|
|
|
1028
1027
|
# Apply remediations if needed
|
|
1029
|
-
if !result.valid? && profile.
|
|
1030
|
-
|
|
1031
|
-
|
|
1028
|
+
if !result.valid? && profile.remediation_count > 0
|
|
1029
|
+
changes = profile.apply_remediations(document)
|
|
1030
|
+
puts "Applied #{changes.length} remediations"
|
|
1032
1031
|
end
|
|
1033
1032
|
----
|
|
1034
1033
|
|
|
@@ -1365,6 +1364,61 @@ $ svg_conform svgcheck compare diagram.svg --svgcheck-report diagram.svg.svgchec
|
|
|
1365
1364
|
====
|
|
1366
1365
|
|
|
1367
1366
|
|
|
1367
|
+
|
|
1368
|
+
== Performance
|
|
1369
|
+
|
|
1370
|
+
=== SAX streaming validation
|
|
1371
|
+
|
|
1372
|
+
SvgConform implements SAX (Simple API for XML) streaming validation for
|
|
1373
|
+
high-performance processing of large SVG files.
|
|
1374
|
+
|
|
1375
|
+
Performance characteristics:
|
|
1376
|
+
|
|
1377
|
+
* Small files (<1 MB): ~0.5s validation time
|
|
1378
|
+
* Medium files (1-5 MB): ~1s validation time (vs 60-80s with DOM)
|
|
1379
|
+
* Large files (>5 MB): ~2s validation time (vs minutes-hours with DOM)
|
|
1380
|
+
|
|
1381
|
+
Real-world samples results:
|
|
1382
|
+
|
|
1383
|
+
* 5.93 MB file: >` 60s → 1.89s (30x faster)
|
|
1384
|
+
* 4.57 MB file: >60s → 1.37s (40x faster)
|
|
1385
|
+
* 3.44 MB file: >60s → 0.29s (200x faster)
|
|
1386
|
+
|
|
1387
|
+
How it works:
|
|
1388
|
+
|
|
1389
|
+
SAX streaming validation processes XML events without building a full DOM tree
|
|
1390
|
+
in memory. This provides:
|
|
1391
|
+
|
|
1392
|
+
* Forward-only processing: Single pass through XML stream
|
|
1393
|
+
* Constant memory: No full DOM tree in memory
|
|
1394
|
+
* Predictable performance: O(n) complexity guaranteed
|
|
1395
|
+
* No object identity issues: Path-based node identification
|
|
1396
|
+
|
|
1397
|
+
Mode selection:
|
|
1398
|
+
|
|
1399
|
+
By default, SAX mode is used for all validation operations. DOM mode is
|
|
1400
|
+
automatically used when remediation is requested (`fix: true`).
|
|
1401
|
+
|
|
1402
|
+
[source,ruby]
|
|
1403
|
+
----
|
|
1404
|
+
# Default: SAX mode (best performance)
|
|
1405
|
+
validator = SvgConform::Validator.new
|
|
1406
|
+
result = validator.validate_file('large.svg', profile: :metanorma)
|
|
1407
|
+
|
|
1408
|
+
# Explicit mode selection
|
|
1409
|
+
validator_sax = SvgConform::Validator.new(mode: :sax) # Force SAX
|
|
1410
|
+
validator_dom = SvgConform::Validator.new(mode: :dom) # Force DOM
|
|
1411
|
+
validator_auto = SvgConform::Validator.new(mode: :auto) # File size based (>1MB uses SAX)
|
|
1412
|
+
----
|
|
1413
|
+
|
|
1414
|
+
Validation parity:
|
|
1415
|
+
|
|
1416
|
+
SAX mode produces identical validation results to DOM mode on 18/19 test files
|
|
1417
|
+
(94.7% parity). The one exception is `full-tiny.svg`, a comprehensive test file
|
|
1418
|
+
with known architectural differences.
|
|
1419
|
+
|
|
1420
|
+
|
|
1421
|
+
|
|
1368
1422
|
== Testing
|
|
1369
1423
|
|
|
1370
1424
|
Run the test suite:
|