postsvg 0.2.2 → 0.3.0

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 (81) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop_todo.yml +49 -533
  3. data/Gemfile +1 -1
  4. data/lib/postsvg/cli.rb +5 -10
  5. data/lib/postsvg/color.rb +132 -0
  6. data/lib/postsvg/format_number.rb +22 -0
  7. data/lib/postsvg/graphics_context.rb +1 -2
  8. data/lib/postsvg/matrix.rb +106 -0
  9. data/lib/postsvg/model/literals/array.rb +41 -0
  10. data/lib/postsvg/model/literals/dictionary.rb +34 -0
  11. data/lib/postsvg/model/literals/hex.rb +37 -0
  12. data/lib/postsvg/model/literals/name.rb +40 -0
  13. data/lib/postsvg/model/literals/number.rb +36 -0
  14. data/lib/postsvg/model/literals/procedure.rb +41 -0
  15. data/lib/postsvg/model/literals/string.rb +30 -0
  16. data/lib/postsvg/model/literals.rb +19 -0
  17. data/lib/postsvg/model/operator.rb +58 -0
  18. data/lib/postsvg/model/operators/arithmetic.rb +264 -0
  19. data/lib/postsvg/model/operators/boolean.rb +182 -0
  20. data/lib/postsvg/model/operators/color.rb +74 -0
  21. data/lib/postsvg/model/operators/container.rb +186 -0
  22. data/lib/postsvg/model/operators/control_flow.rb +119 -0
  23. data/lib/postsvg/model/operators/device.rb +21 -0
  24. data/lib/postsvg/model/operators/dictionary.rb +118 -0
  25. data/lib/postsvg/model/operators/font.rb +121 -0
  26. data/lib/postsvg/model/operators/graphics_state.rb +84 -0
  27. data/lib/postsvg/model/operators/painting.rb +29 -0
  28. data/lib/postsvg/model/operators/path.rb +169 -0
  29. data/lib/postsvg/model/operators/stack.rb +72 -0
  30. data/lib/postsvg/model/operators/transformations.rb +103 -0
  31. data/lib/postsvg/model/operators.rb +89 -0
  32. data/lib/postsvg/model/program.rb +68 -0
  33. data/lib/postsvg/model/token.rb +43 -0
  34. data/lib/postsvg/model.rb +17 -0
  35. data/lib/postsvg/options.rb +1 -1
  36. data/lib/postsvg/parser/postscript_parser.rb +7 -7
  37. data/lib/postsvg/renderer.rb +3 -7
  38. data/lib/postsvg/serializer.rb +325 -0
  39. data/lib/postsvg/source/ast_builder.rb +308 -0
  40. data/lib/postsvg/source/lexer.rb +322 -0
  41. data/lib/postsvg/source/operand_stack.rb +55 -0
  42. data/lib/postsvg/source.rb +21 -0
  43. data/lib/postsvg/svg/clip_path_registry.rb +1 -3
  44. data/lib/postsvg/svg/element.rb +1 -3
  45. data/lib/postsvg/svg/elements/ellipse.rb +1 -2
  46. data/lib/postsvg/svg/elements/svg.rb +1 -2
  47. data/lib/postsvg/svg/paint.rb +1 -1
  48. data/lib/postsvg/svg/path_data/parser.rb +6 -10
  49. data/lib/postsvg/svg/stroke.rb +2 -4
  50. data/lib/postsvg/svg/transform_list.rb +1 -1
  51. data/lib/postsvg/svg_builder.rb +11 -15
  52. data/lib/postsvg/translation/arc_converter.rb +12 -22
  53. data/lib/postsvg/translation/bounding_box.rb +4 -7
  54. data/lib/postsvg/translation/handlers/circle_handler.rb +2 -2
  55. data/lib/postsvg/translation/handlers/ellipse_handler.rb +3 -8
  56. data/lib/postsvg/translation/handlers/group_handler.rb +1 -2
  57. data/lib/postsvg/translation/handlers/image_handler.rb +2 -3
  58. data/lib/postsvg/translation/handlers/line_handler.rb +2 -6
  59. data/lib/postsvg/translation/handlers/open_handler.rb +2 -3
  60. data/lib/postsvg/translation/handlers/path_handler.rb +41 -57
  61. data/lib/postsvg/translation/handlers/polygon_handler.rb +2 -4
  62. data/lib/postsvg/translation/handlers/polyline_handler.rb +2 -4
  63. data/lib/postsvg/translation/handlers/rect_handler.rb +5 -10
  64. data/lib/postsvg/translation/handlers/shared.rb +11 -11
  65. data/lib/postsvg/translation/handlers/svg_handler.rb +2 -3
  66. data/lib/postsvg/translation/handlers/text_handler.rb +7 -8
  67. data/lib/postsvg/translation/handlers.rb +1 -2
  68. data/lib/postsvg/translation/ps_renderer.rb +1 -2
  69. data/lib/postsvg/version.rb +1 -1
  70. data/lib/postsvg/visitors/ps_visitor/arithmetic.rb +6 -6
  71. data/lib/postsvg/visitors/ps_visitor/color.rb +5 -8
  72. data/lib/postsvg/visitors/ps_visitor/common.rb +2 -1
  73. data/lib/postsvg/visitors/ps_visitor/container.rb +13 -13
  74. data/lib/postsvg/visitors/ps_visitor/control_flow.rb +3 -3
  75. data/lib/postsvg/visitors/ps_visitor/dictionary.rb +4 -8
  76. data/lib/postsvg/visitors/ps_visitor/font.rb +4 -14
  77. data/lib/postsvg/visitors/ps_visitor/graphics_state.rb +4 -4
  78. data/lib/postsvg/visitors/ps_visitor/painting.rb +1 -1
  79. data/lib/postsvg/visitors/ps_visitor/path.rb +4 -9
  80. data/lib/postsvg.rb +37 -42
  81. metadata +36 -16
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cc86d0544a9c47fdfedf108692538b5d362fca385c366889ed7ffd3accc40ef4
4
- data.tar.gz: 765f530771bb2168d0bfff09b0f66f7edfc1f78b671ba59dd294646b245e06dc
3
+ metadata.gz: 7eb334f9e4c74e3038c41e80d545bcaec37aa5032f20aa2d27fe61da5795542f
4
+ data.tar.gz: 2df77c30cad2f75203764b86835e3e0cded61db1b8b658882e342ed5b2f6c91d
5
5
  SHA512:
6
- metadata.gz: 1eafc7316bb8441c1bcb6c87efc1889b895e661cd20fab659274a7dd9bf5960041fa9901d150f8004162cecb4f605daf3ea49127994415cd30c3b4c7d72b6edc
7
- data.tar.gz: 3d24279bccbeaf85e08da0f3e0acac1d21cf5411d69f2e872bd09e6fc276f09bec27ec3d34680138c164336655e337d998a3c8d90691bc46033469be9e0f1e78
6
+ metadata.gz: ab6b8afd0962151ce8f2799cd260d69bf5a4343b847a44f454dcc84cf847066f4e48e07e577d397071e4387cd68f3d58665e754bd4d07ac0b26fa87ba85f37e9
7
+ data.tar.gz: c844ee5ab50f674a1e3f186131d4da0840516eb35ff7cccb210e4ca64441560ca18c207103702eaa0c88679ef91343e10a8f8f0f2c54ae74963e06587dd23203
data/.rubocop_todo.yml CHANGED
@@ -1,348 +1,98 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2026-07-27 10:08:25 UTC using RuboCop version 1.88.2.
3
+ # on 2025-10-19 09:58:29 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: 68
9
+ # Offense count: 36
10
10
  # This cop supports safe autocorrection (--autocorrect).
11
- # Configuration parameters: EnforcedStyle, IndentationWidth.
12
- # SupportedStyles: with_first_argument, with_fixed_indentation
13
- Layout/ArgumentAlignment:
14
- Enabled: false
15
-
16
- # Offense count: 7
17
- # This cop supports safe autocorrection (--autocorrect).
18
- # Configuration parameters: EnforcedStyle, IndentationWidth.
19
- # SupportedStyles: with_first_element, with_fixed_indentation
20
- Layout/ArrayAlignment:
21
- Exclude:
22
- - 'lib/postsvg/renderer.rb'
23
- - 'lib/postsvg/translation/bounding_box.rb'
24
- - 'lib/postsvg/translation/handlers/path_handler.rb'
25
- - 'spec/postsvg/integration_spec.rb'
26
-
27
- # Offense count: 4
28
- # This cop supports safe autocorrection (--autocorrect).
29
- # Configuration parameters: EnforcedStyleAlignWith.
30
- # SupportedStylesAlignWith: either, start_of_block, start_of_line
31
- Layout/BlockAlignment:
32
- Exclude:
33
- - 'lib/postsvg/svg/clip_path_registry.rb'
34
- - 'lib/postsvg/svg/element.rb'
35
- - 'spec/postsvg/format_number_spec.rb'
36
-
37
- # Offense count: 4
38
- # This cop supports safe autocorrection (--autocorrect).
39
- Layout/BlockEndNewline:
40
- Exclude:
41
- - 'lib/postsvg/svg/clip_path_registry.rb'
42
- - 'lib/postsvg/svg/element.rb'
43
- - 'spec/postsvg/format_number_spec.rb'
44
-
45
- # Offense count: 4
46
- # This cop supports safe autocorrection (--autocorrect).
47
- # Configuration parameters: EnforcedStyle, IndentOneStep, IndentationWidth.
48
- # SupportedStyles: case, end
49
- Layout/CaseIndentation:
50
- Exclude:
51
- - 'lib/postsvg/visitors/ps_visitor/container.rb'
52
-
53
- # Offense count: 19
54
- # This cop supports safe autocorrection (--autocorrect).
55
- # Configuration parameters: IndentationWidth.
56
- Layout/ClosingParenthesisIndentation:
57
- Exclude:
58
- - 'lib/postsvg/translation/handlers/circle_handler.rb'
59
- - 'lib/postsvg/translation/handlers/ellipse_handler.rb'
60
- - 'lib/postsvg/translation/handlers/line_handler.rb'
61
- - 'lib/postsvg/translation/handlers/path_handler.rb'
62
- - 'lib/postsvg/translation/handlers/shared.rb'
63
- - 'lib/postsvg/translation/handlers/text_handler.rb'
64
- - 'spec/postsvg/serializer_spec.rb'
65
-
66
- # Offense count: 5
67
- # This cop supports safe autocorrection (--autocorrect).
68
- Layout/ElseAlignment:
69
- Exclude:
70
- - 'lib/postsvg/svg/path_data/parser.rb'
71
- - 'lib/postsvg/visitors/ps_visitor/container.rb'
72
- - 'lib/postsvg/visitors/ps_visitor/font.rb'
73
- - 'lib/postsvg/visitors/ps_visitor/path.rb'
74
-
75
- # Offense count: 1
76
- # This cop supports safe autocorrection (--autocorrect).
77
- Layout/EmptyLinesAfterModuleInclusion:
78
- Exclude:
79
- - 'spec/postsvg/model/operators_spec.rb'
80
-
81
- # Offense count: 1
82
- # This cop supports safe autocorrection (--autocorrect).
83
- # Configuration parameters: AllowAliasSyntax, AllowedMethods.
84
- # AllowedMethods: alias_method, public, protected, private
85
- Layout/EmptyLinesAroundAttributeAccessor:
86
- Exclude:
87
- - 'spec/postsvg/model/operators_spec.rb'
88
-
89
- # Offense count: 4
90
- # This cop supports safe autocorrection (--autocorrect).
91
- # Configuration parameters: EnforcedStyleAlignWith.
92
- # SupportedStylesAlignWith: keyword, variable, start_of_line
93
- Layout/EndAlignment:
94
- Exclude:
95
- - 'lib/postsvg/svg/path_data/parser.rb'
96
- - 'lib/postsvg/visitors/ps_visitor/font.rb'
97
- - 'lib/postsvg/visitors/ps_visitor/path.rb'
98
-
99
- # Offense count: 1
100
- # This cop supports safe autocorrection (--autocorrect).
101
- # Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment.
102
- Layout/ExtraSpacing:
103
- Exclude:
104
- - 'lib/postsvg/translation/arc_converter.rb'
105
-
106
- # Offense count: 19
107
- # This cop supports safe autocorrection (--autocorrect).
108
- # Configuration parameters: EnforcedStyle, IndentationWidth.
109
- # SupportedStyles: consistent, consistent_relative_to_receiver, special_for_inner_method_call, special_for_inner_method_call_in_parentheses
110
- Layout/FirstArgumentIndentation:
111
- Exclude:
112
- - 'lib/postsvg/translation/handlers/circle_handler.rb'
113
- - 'lib/postsvg/translation/handlers/ellipse_handler.rb'
114
- - 'lib/postsvg/translation/handlers/line_handler.rb'
115
- - 'lib/postsvg/translation/handlers/path_handler.rb'
116
- - 'lib/postsvg/translation/handlers/shared.rb'
117
- - 'lib/postsvg/translation/handlers/text_handler.rb'
118
- - 'spec/postsvg/serializer_spec.rb'
119
-
120
- # Offense count: 4
121
- # This cop supports safe autocorrection (--autocorrect).
122
- # Configuration parameters: EnforcedStyle, IndentationWidth.
123
- # SupportedStyles: special_inside_parentheses, consistent, align_brackets
124
- Layout/FirstArrayElementIndentation:
125
- Exclude:
126
- - 'lib/postsvg/translation/handlers/path_handler.rb'
127
- - 'lib/postsvg/translation/handlers/shared.rb'
128
-
129
- # Offense count: 47
130
- # This cop supports safe autocorrection (--autocorrect).
131
- # Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
132
- # SupportedHashRocketStyles: key, separator, table
133
- # SupportedColonStyles: key, separator, table
134
- # SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
135
- Layout/HashAlignment:
136
- Exclude:
137
- - 'lib/postsvg/translation/bounding_box.rb'
138
- - 'lib/postsvg/translation/handlers/ellipse_handler.rb'
139
- - 'lib/postsvg/translation/handlers/path_handler.rb'
140
- - 'lib/postsvg/translation/handlers/polygon_handler.rb'
141
- - 'lib/postsvg/translation/handlers/polyline_handler.rb'
142
- - 'lib/postsvg/translation/handlers/rect_handler.rb'
143
- - 'lib/postsvg/translation/handlers/text_handler.rb'
144
- - 'lib/postsvg/translation/ps_renderer.rb'
145
- - 'lib/postsvg/visitors/ps_visitor/font.rb'
146
- - 'lib/postsvg/visitors/ps_visitor/path.rb'
147
- - 'spec/postsvg/serializer_spec.rb'
148
-
149
- # Offense count: 4
150
- # This cop supports safe autocorrection (--autocorrect).
151
- # Configuration parameters: EnforcedStyle.
152
- # SupportedStyles: normal, indented_internal_methods
153
- Layout/IndentationConsistency:
154
- Exclude:
155
- - 'spec/postsvg/model/operators_spec.rb'
156
-
157
- # Offense count: 23
158
- # This cop supports safe autocorrection (--autocorrect).
159
- # Configuration parameters: Width, EnforcedStyleAlignWith, AllowedPatterns.
160
- # SupportedStylesAlignWith: start_of_line, relative_to_receiver
161
- Layout/IndentationWidth:
162
- Exclude:
163
- - 'lib/postsvg/svg/clip_path_registry.rb'
164
- - 'lib/postsvg/svg/element.rb'
165
- - 'lib/postsvg/svg/path_data/parser.rb'
166
- - 'lib/postsvg/visitors/ps_visitor/container.rb'
167
- - 'lib/postsvg/visitors/ps_visitor/font.rb'
168
- - 'lib/postsvg/visitors/ps_visitor/path.rb'
169
- - 'spec/postsvg/format_number_spec.rb'
170
-
171
- # Offense count: 173
172
- # This cop supports safe autocorrection (--autocorrect).
173
- # Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings.
11
+ # Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings.
174
12
  # URISchemes: http, https
175
13
  Layout/LineLength:
176
- Enabled: false
177
-
178
- # Offense count: 7
179
- # This cop supports safe autocorrection (--autocorrect).
180
- # Configuration parameters: EnforcedStyle.
181
- # SupportedStyles: symmetrical, new_line, same_line
182
- Layout/MultilineMethodCallBraceLayout:
183
- Exclude:
184
- - 'lib/postsvg/translation/handlers/ellipse_handler.rb'
185
- - 'lib/postsvg/translation/handlers/line_handler.rb'
186
- - 'lib/postsvg/translation/handlers/path_handler.rb'
187
- - 'spec/postsvg/serializer_spec.rb'
188
-
189
- # Offense count: 7
190
- # This cop supports safe autocorrection (--autocorrect).
191
- # Configuration parameters: EnforcedStyle, IndentationWidth.
192
- # SupportedStyles: aligned, indented, indented_relative_to_receiver
193
- Layout/MultilineMethodCallIndentation:
194
- Exclude:
195
- - 'lib/postsvg/svg/path_data/parser.rb'
196
- - 'lib/postsvg/svg_builder.rb'
197
-
198
- # Offense count: 4
199
- # This cop supports safe autocorrection (--autocorrect).
200
- # Configuration parameters: EnforcedStyle, IndentationWidth.
201
- # SupportedStyles: aligned, indented
202
- Layout/MultilineOperationIndentation:
203
14
  Exclude:
15
+ - 'lib/postsvg.rb'
16
+ - 'lib/postsvg/converter.rb'
17
+ - 'lib/postsvg/graphics_state.rb'
18
+ - 'lib/postsvg/interpreter.rb'
204
19
  - 'lib/postsvg/parser/postscript_parser.rb'
20
+ - 'lib/postsvg/tokenizer.rb'
21
+ - 'postsvg.gemspec'
22
+ - 'scripts/regenerate_fixtures.rb'
205
23
 
206
- # Offense count: 1
207
- # This cop supports safe autocorrection (--autocorrect).
208
- # Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator, EnforcedStyleForRationalLiterals.
209
- # SupportedStylesForExponentOperator: space, no_space
210
- # SupportedStylesForRationalLiterals: space, no_space
211
- Layout/SpaceAroundOperators:
212
- Exclude:
213
- - 'lib/postsvg/translation/arc_converter.rb'
214
-
215
- # Offense count: 2
216
- # This cop supports safe autocorrection (--autocorrect).
217
- # Configuration parameters: EnforcedStyle.
218
- # SupportedStyles: final_newline, final_blank_line
219
- Layout/TrailingEmptyLines:
220
- Exclude:
221
- - 'lib/postsvg/translation/handlers/open_handler.rb'
222
- - 'lib/postsvg/translation/handlers/svg_handler.rb'
223
-
224
- # Offense count: 54
225
- # This cop supports safe autocorrection (--autocorrect).
226
- # Configuration parameters: AllowInHeredoc.
227
- Layout/TrailingWhitespace:
228
- Enabled: false
229
-
230
- # Offense count: 38
231
- # This cop supports safe autocorrection (--autocorrect).
232
- Lint/AmbiguousOperatorPrecedence:
233
- Exclude:
234
- - 'lib/postsvg/translation/arc_converter.rb'
235
- - 'lib/postsvg/translation/handlers/path_handler.rb'
236
- - 'lib/postsvg/visitors/ps_visitor/arithmetic.rb'
237
-
238
- # Offense count: 14
24
+ # Offense count: 5
239
25
  # Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches, IgnoreDuplicateElseBranch.
240
26
  Lint/DuplicateBranch:
241
27
  Exclude:
242
28
  - 'lib/postsvg/converter.rb'
243
29
  - 'lib/postsvg/interpreter.rb'
244
- - 'lib/postsvg/svg/path_data/command.rb'
245
- - 'lib/postsvg/svg/path_data/parser.rb'
246
- - 'lib/postsvg/visitors/ps_visitor/common.rb'
247
- - 'lib/postsvg/visitors/ps_visitor/container.rb'
248
- - 'lib/postsvg/visitors/ps_visitor/font.rb'
249
30
 
250
31
  # Offense count: 1
251
32
  Lint/DuplicateCaseCondition:
252
33
  Exclude:
253
34
  - 'lib/postsvg/converter.rb'
254
35
 
255
- # Offense count: 2
256
- Lint/DuplicateMethods:
257
- Exclude:
258
- - 'lib/postsvg/translation/handlers/path_handler.rb'
259
-
260
- # Offense count: 3
261
- Lint/FloatComparison:
262
- Exclude:
263
- - 'lib/postsvg/svg/stroke.rb'
264
- - 'lib/postsvg/svg_builder.rb'
265
-
266
- # Offense count: 1
267
- Lint/StructNewOverride:
268
- Exclude:
269
- - 'lib/postsvg/visitors/ps_visitor/font.rb'
270
-
271
- # Offense count: 5
272
- # This cop supports safe autocorrection (--autocorrect).
273
- # Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods, NotImplementedExceptions.
274
- # NotImplementedExceptions: NotImplementedError
275
- Lint/UnusedMethodArgument:
276
- Exclude:
277
- - 'lib/postsvg/translation/handlers/path_handler.rb'
278
- - 'lib/postsvg/visitors/ps_visitor/container.rb'
279
-
280
- # Offense count: 1
281
- # This cop supports safe autocorrection (--autocorrect).
282
- Lint/UselessAssignment:
283
- Exclude:
284
- - 'lib/postsvg/translation/handlers/image_handler.rb'
285
-
286
- # Offense count: 1
287
- # This cop supports unsafe autocorrection (--autocorrect-all).
288
- Lint/UselessOr:
289
- Exclude:
290
- - 'lib/postsvg/visitors/ps_visitor/font.rb'
291
-
292
- # Offense count: 74
36
+ # Offense count: 29
293
37
  # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max.
294
38
  Metrics/AbcSize:
295
- Enabled: false
296
-
297
- # Offense count: 2
298
- # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns, inherit_mode.
299
- # AllowedMethods: refine
300
- Metrics/BlockLength:
301
- Max: 85
39
+ Exclude:
40
+ - 'lib/postsvg.rb'
41
+ - 'lib/postsvg/cli.rb'
42
+ - 'lib/postsvg/colors.rb'
43
+ - 'lib/postsvg/converter.rb'
44
+ - 'lib/postsvg/graphics_state.rb'
45
+ - 'lib/postsvg/interpreter.rb'
46
+ - 'lib/postsvg/matrix.rb'
47
+ - 'lib/postsvg/path_builder.rb'
48
+ - 'lib/postsvg/svg_generator.rb'
49
+ - 'lib/postsvg/tokenizer.rb'
302
50
 
303
51
  # Offense count: 1
304
52
  # Configuration parameters: CountBlocks, CountModifierForms.
305
53
  Metrics/BlockNesting:
306
54
  Max: 6
307
55
 
308
- # Offense count: 33
56
+ # Offense count: 14
309
57
  # Configuration parameters: AllowedMethods, AllowedPatterns, Max.
310
58
  Metrics/CyclomaticComplexity:
311
- Enabled: false
59
+ Exclude:
60
+ - 'lib/postsvg/cli.rb'
61
+ - 'lib/postsvg/converter.rb'
62
+ - 'lib/postsvg/interpreter.rb'
63
+ - 'lib/postsvg/tokenizer.rb'
312
64
 
313
- # Offense count: 76
65
+ # Offense count: 30
314
66
  # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
315
67
  Metrics/MethodLength:
316
68
  Max: 111
317
69
 
318
- # Offense count: 21
70
+ # Offense count: 5
319
71
  # Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
320
72
  Metrics/ParameterLists:
321
- Max: 10
73
+ Max: 7
322
74
 
323
- # Offense count: 24
75
+ # Offense count: 13
324
76
  # Configuration parameters: AllowedMethods, AllowedPatterns, Max.
325
77
  Metrics/PerceivedComplexity:
326
78
  Exclude:
79
+ - 'lib/postsvg/cli.rb'
327
80
  - 'lib/postsvg/converter.rb'
328
81
  - 'lib/postsvg/interpreter.rb'
329
- - 'lib/postsvg/svg/paint.rb'
330
- - 'lib/postsvg/svg/path_data/parser.rb'
331
- - 'lib/postsvg/svg/transform_list.rb'
332
- - 'lib/postsvg/svg_builder.rb'
333
82
  - 'lib/postsvg/tokenizer.rb'
334
- - 'lib/postsvg/translation/arc_converter.rb'
335
- - 'lib/postsvg/translation/handlers/shared.rb'
336
- - 'lib/postsvg/visitors/ps_visitor/container.rb'
337
- - 'lib/postsvg/visitors/ps_visitor/control_flow.rb'
338
- - 'lib/postsvg/visitors/ps_visitor/painting.rb'
339
- - 'lib/postsvg/visitors/ps_visitor/path.rb'
340
83
 
341
- # Offense count: 254
84
+ # Offense count: 67
342
85
  # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
343
86
  # AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to
344
87
  Naming/MethodParameterName:
345
- Enabled: false
88
+ Exclude:
89
+ - 'lib/postsvg.rb'
90
+ - 'lib/postsvg/converter.rb'
91
+ - 'lib/postsvg/graphics_state.rb'
92
+ - 'lib/postsvg/interpreter.rb'
93
+ - 'lib/postsvg/matrix.rb'
94
+ - 'lib/postsvg/path_builder.rb'
95
+ - 'lib/postsvg/tokenizer.rb'
346
96
 
347
97
  # Offense count: 1
348
98
  # Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros, UseSorbetSigs.
@@ -354,272 +104,38 @@ Naming/PredicatePrefix:
354
104
  Exclude:
355
105
  - 'lib/postsvg/interpreter.rb'
356
106
 
357
- # Offense count: 4
107
+ # Offense count: 3
358
108
  # Configuration parameters: MinSize.
359
109
  Performance/CollectionLiteralInLoop:
360
110
  Exclude:
361
111
  - 'lib/postsvg/interpreter.rb'
362
- - 'lib/postsvg/svg/path_data/parser.rb'
363
112
 
364
113
  # Offense count: 1
365
- # This cop supports unsafe autocorrection (--autocorrect-all).
366
- # Configuration parameters: SafeMultiline.
367
- Performance/DeletePrefix:
368
- Exclude:
369
- - 'lib/postsvg/visitors/ps_visitor/common.rb'
370
-
371
- # Offense count: 1
372
- # This cop supports unsafe autocorrection (--autocorrect-all).
373
- Performance/MapCompact:
374
- Exclude:
375
- - 'lib/postsvg/svg/clip_path_registry.rb'
376
-
377
- # Offense count: 5
378
- RSpec/BeforeAfterAll:
379
- Exclude:
380
- - 'spec/postsvg/model/operator_spec.rb'
381
- - 'spec/postsvg/model/operators_spec.rb'
382
- - 'spec/postsvg/svg/elements_spec.rb'
383
- - 'spec/postsvg/translation/handlers_spec.rb'
384
- - 'spec/postsvg/translation/ps_renderer_spec.rb'
385
-
386
- # Offense count: 10
387
114
  # Configuration parameters: IgnoredMetadata.
388
115
  RSpec/DescribeClass:
389
116
  Exclude:
390
117
  - 'spec/postsvg/integration_spec.rb'
391
- - 'spec/postsvg/round_trip_spec.rb'
392
- - 'spec/postsvg/svg/elements_spec.rb'
393
- - 'spec/postsvg/visitors/ps_visitor_behavior_spec.rb'
394
-
395
- # Offense count: 30
396
- # This cop supports unsafe autocorrection (--autocorrect-all).
397
- # Configuration parameters: SkipBlocks, EnforcedStyle, OnlyStaticConstants.
398
- # SupportedStyles: described_class, explicit
399
- RSpec/DescribedClass:
400
- Exclude:
401
- - 'spec/postsvg/color_spec.rb'
402
- - 'spec/postsvg/format_number_spec.rb'
403
- - 'spec/postsvg/matrix_spec.rb'
404
- - 'spec/postsvg/model/operators_spec.rb'
405
- - 'spec/postsvg/svg/parser_spec.rb'
406
118
 
407
- # Offense count: 22
119
+ # Offense count: 7
408
120
  # Configuration parameters: CountAsOne.
409
121
  RSpec/ExampleLength:
410
- Max: 18
411
-
412
- # Offense count: 1
413
- RSpec/IdenticalEqualityAssertion:
414
- Exclude:
415
- - 'spec/postsvg/color_spec.rb'
416
-
417
- # Offense count: 1
418
- # This cop supports safe autocorrection (--autocorrect).
419
- RSpec/MatchWithSimpleRegex:
420
- Exclude:
421
- - 'spec/postsvg/integration_spec.rb'
422
-
423
- # Offense count: 4
424
- RSpec/MultipleDescribes:
425
- Exclude:
426
- - 'spec/postsvg/round_trip_spec.rb'
427
- - 'spec/postsvg/svg/parser_spec.rb'
428
- - 'spec/postsvg/translation/ps_renderer_spec.rb'
429
- - 'spec/postsvg/visitors/ps_visitor_behavior_spec.rb'
122
+ Max: 16
430
123
 
431
- # Offense count: 59
124
+ # Offense count: 3
432
125
  RSpec/MultipleExpectations:
433
- Max: 7
434
-
435
- # Offense count: 5
436
- # This cop supports safe autocorrection (--autocorrect).
437
- # Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, AllowedMethods, AllowedPatterns, AllowBracesOnProceduralOneLiners, BracesRequiredMethods.
438
- # SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
439
- # ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
440
- # FunctionalMethods: let, let!, subject, watch
441
- # AllowedMethods: lambda, proc, it
442
- Style/BlockDelimiters:
443
- Exclude:
444
- - 'lib/postsvg/svg/clip_path_registry.rb'
445
- - 'lib/postsvg/svg/element.rb'
446
- - 'spec/postsvg/format_number_spec.rb'
447
-
448
- # Offense count: 7
449
- # This cop supports safe autocorrection (--autocorrect).
450
- Style/ComparableClamp:
451
- Exclude:
452
- - 'lib/postsvg/colors.rb'
126
+ Max: 4
453
127
 
454
128
  # Offense count: 1
455
129
  # This cop supports safe autocorrection (--autocorrect).
456
- # Configuration parameters: EnforcedStyle, SingleLineConditionsOnly, IncludeTernaryExpressions.
457
- # SupportedStyles: assign_to_condition, assign_inside_condition
458
- Style/ConditionalAssignment:
459
- Exclude:
460
- - 'lib/postsvg/visitors/ps_visitor/container.rb'
461
-
462
- # Offense count: 3
463
- # This cop supports safe autocorrection (--autocorrect).
464
130
  # Configuration parameters: EnforcedStyle, AllowComments.
465
131
  # SupportedStyles: empty, nil, both
466
132
  Style/EmptyElse:
467
133
  Exclude:
468
134
  - 'lib/postsvg/converter.rb'
469
- - 'lib/postsvg/visitors/ps_visitor/common.rb'
470
- - 'lib/postsvg/visitors/ps_visitor/graphics_state.rb'
471
135
 
472
- # Offense count: 1
473
- # This cop supports unsafe autocorrection (--autocorrect-all).
474
- # Configuration parameters: EnforcedStyle.
475
- # SupportedStyles: left_coerce, right_coerce, single_coerce, fdiv
476
- Style/FloatDivision:
477
- Exclude:
478
- - 'lib/postsvg/visitors/ps_visitor/arithmetic.rb'
479
-
480
- # Offense count: 16
136
+ # Offense count: 12
481
137
  # This cop supports safe autocorrection (--autocorrect).
482
138
  # Configuration parameters: MaxUnannotatedPlaceholdersAllowed, Mode, AllowedMethods, AllowedPatterns.
483
139
  # SupportedStyles: annotated, template, unannotated
484
140
  Style/FormatStringToken:
485
141
  EnforcedStyle: unannotated
486
-
487
- # Offense count: 1
488
- # This cop supports unsafe autocorrection (--autocorrect-all).
489
- # Configuration parameters: AllowedReceivers.
490
- # AllowedReceivers: Thread.current
491
- Style/HashEachMethods:
492
- Exclude:
493
- - 'spec/postsvg/integration_spec.rb'
494
-
495
- # Offense count: 2
496
- # This cop supports safe autocorrection (--autocorrect).
497
- Style/MultilineIfModifier:
498
- Exclude:
499
- - 'lib/postsvg/renderer.rb'
500
- - 'lib/postsvg/svg_builder.rb'
501
-
502
- # Offense count: 2
503
- # This cop supports safe autocorrection (--autocorrect).
504
- Style/MultilineTernaryOperator:
505
- Exclude:
506
- - 'lib/postsvg/visitors/ps_visitor/font.rb'
507
-
508
- # Offense count: 1
509
- # This cop supports unsafe autocorrection (--autocorrect-all).
510
- # Configuration parameters: EnforcedStyle, Recursive.
511
- # SupportedStyles: literals, strict
512
- Style/MutableConstant:
513
- Exclude:
514
- - 'lib/postsvg/svg/element.rb'
515
-
516
- # Offense count: 2
517
- # This cop supports safe autocorrection (--autocorrect).
518
- Style/NestedTernaryOperator:
519
- Exclude:
520
- - 'lib/postsvg/svg/path_data/parser.rb'
521
- - 'lib/postsvg/visitors/ps_visitor/path.rb'
522
-
523
- # Offense count: 4
524
- # This cop supports safe autocorrection (--autocorrect).
525
- Style/ParallelAssignment:
526
- Exclude:
527
- - 'lib/postsvg/translation/handlers/path_handler.rb'
528
- - 'lib/postsvg/translation/handlers/rect_handler.rb'
529
-
530
- # Offense count: 5
531
- # This cop supports safe autocorrection (--autocorrect).
532
- Style/RedundantFreeze:
533
- Exclude:
534
- - 'lib/postsvg/svg/path_data/parser.rb'
535
- - 'lib/postsvg/svg_builder.rb'
536
-
537
- # Offense count: 1
538
- # This cop supports safe autocorrection (--autocorrect).
539
- Style/RedundantInterpolationUnfreeze:
540
- Exclude:
541
- - 'lib/postsvg/svg_builder.rb'
542
-
543
- # Offense count: 5
544
- # This cop supports safe autocorrection (--autocorrect).
545
- Style/RedundantParentheses:
546
- Exclude:
547
- - 'lib/postsvg/parser/postscript_parser.rb'
548
- - 'lib/postsvg/translation/handlers/shared.rb'
549
-
550
- # Offense count: 1
551
- # This cop supports safe autocorrection (--autocorrect).
552
- Style/RedundantRegexpArgument:
553
- Exclude:
554
- - 'lib/postsvg/svg/path_data/parser.rb'
555
-
556
- # Offense count: 5
557
- # This cop supports unsafe autocorrection (--autocorrect-all).
558
- # Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods, MaxChainLength.
559
- # AllowedMethods: present?, blank?, presence, try, try!
560
- Style/SafeNavigation:
561
- Exclude:
562
- - 'lib/postsvg/translation/handlers/shared.rb'
563
- - 'lib/postsvg/translation/handlers/text_handler.rb'
564
-
565
- # Offense count: 4
566
- # This cop supports safe autocorrection (--autocorrect).
567
- # Configuration parameters: AllowAsExpressionSeparator.
568
- Style/Semicolon:
569
- Exclude:
570
- - 'spec/postsvg/model/operators_spec.rb'
571
-
572
- # Offense count: 1
573
- # This cop supports safe autocorrection (--autocorrect).
574
- # Configuration parameters: AllowModifier.
575
- Style/SoleNestedConditional:
576
- Exclude:
577
- - 'lib/postsvg/visitors/ps_visitor/path.rb'
578
-
579
- # Offense count: 1
580
- # This cop supports safe autocorrection (--autocorrect).
581
- # Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
582
- # SupportedStyles: single_quotes, double_quotes
583
- Style/StringLiterals:
584
- Exclude:
585
- - 'lib/postsvg/visitors/ps_visitor/common.rb'
586
-
587
- # Offense count: 2
588
- # This cop supports safe autocorrection (--autocorrect).
589
- # Configuration parameters: EnforcedStyle, AllowSafeAssignment.
590
- # SupportedStyles: require_parentheses, require_no_parentheses, require_parentheses_when_complex
591
- Style/TernaryParentheses:
592
- Exclude:
593
- - 'lib/postsvg/svg/path_data/parser.rb'
594
- - 'lib/postsvg/translation/arc_converter.rb'
595
-
596
- # Offense count: 11
597
- # This cop supports safe autocorrection (--autocorrect).
598
- # Configuration parameters: EnforcedStyleForMultiline.
599
- # SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma
600
- Style/TrailingCommaInArguments:
601
- Exclude:
602
- - 'lib/postsvg/translation/handlers/ellipse_handler.rb'
603
- - 'lib/postsvg/translation/handlers/line_handler.rb'
604
- - 'lib/postsvg/translation/handlers/path_handler.rb'
605
- - 'lib/postsvg/visitors/ps_visitor/painting.rb'
606
- - 'spec/postsvg/serializer_spec.rb'
607
- - 'spec/postsvg/translation/arc_converter_spec.rb'
608
-
609
- # Offense count: 3
610
- # This cop supports safe autocorrection (--autocorrect).
611
- # Configuration parameters: EnforcedStyleForMultiline.
612
- # SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma
613
- Style/TrailingCommaInArrayLiteral:
614
- Exclude:
615
- - 'lib/postsvg/translation/bounding_box.rb'
616
- - 'lib/postsvg/translation/handlers/path_handler.rb'
617
- - 'lib/postsvg/translation/handlers/shared.rb'
618
-
619
- # Offense count: 1
620
- # This cop supports safe autocorrection (--autocorrect).
621
- # Configuration parameters: EnforcedStyleForMultiline.
622
- # SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma
623
- Style/TrailingCommaInHashLiteral:
624
- Exclude:
625
- - 'lib/postsvg/options.rb'
data/Gemfile CHANGED
@@ -4,7 +4,7 @@ source "https://rubygems.org"
4
4
 
5
5
  gemspec
6
6
 
7
- gem "canon"
7
+ gem "canon", github: "lutaml/canon", branch: "main"
8
8
  gem "nokogiri"
9
9
  gem "rake"
10
10
  gem "rspec"