protobuf 3.10.8 → 3.10.10

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 (37) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +106 -22
  3. data/.rubocop.yml +30 -11
  4. data/.rubocop_todo.yml +462 -60
  5. data/CHANGES.md +31 -0
  6. data/Gemfile +22 -0
  7. data/lib/protobuf/code_generator.rb +17 -5
  8. data/lib/protobuf/decoder.rb +33 -2
  9. data/lib/protobuf/field/base_field.rb +13 -5
  10. data/lib/protobuf/field/base_field_object_definitions.rb +40 -6
  11. data/lib/protobuf/field/bool_field.rb +2 -1
  12. data/lib/protobuf/field/int32_field.rb +12 -0
  13. data/lib/protobuf/field/sint32_field.rb +10 -0
  14. data/lib/protobuf/field/uint32_field.rb +9 -0
  15. data/lib/protobuf/generators/printable.rb +10 -1
  16. data/lib/protobuf/message/serialization.rb +4 -4
  17. data/lib/protobuf/railtie.rb +48 -0
  18. data/lib/protobuf/rpc/application_service.rb +12 -0
  19. data/lib/protobuf/rpc/buffer.rb +2 -2
  20. data/lib/protobuf/rpc/service.rb +7 -3
  21. data/lib/protobuf/rpc/service_filters.rb +35 -5
  22. data/lib/protobuf/service_loader.rb +21 -0
  23. data/lib/protobuf/version.rb +1 -1
  24. data/lib/protobuf.rb +5 -0
  25. data/protobuf.gemspec +9 -27
  26. data/spec/encoding/packed_decoding_spec.rb +233 -0
  27. data/spec/encoding/wire_compat_decoding_spec.rb +113 -0
  28. data/spec/functional/railtie_boot_spec.rb +84 -0
  29. data/spec/lib/protobuf/field/bool_field_spec.rb +21 -0
  30. data/spec/lib/protobuf/field/string_field_spec.rb +0 -2
  31. data/spec/lib/protobuf/generators/service_generator_spec.rb +23 -0
  32. data/spec/lib/protobuf/message_spec.rb +0 -2
  33. data/spec/lib/protobuf/railtie_spec.rb +86 -0
  34. data/spec/lib/protobuf/rpc/application_service_spec.rb +57 -0
  35. data/spec/lib/protobuf/rpc/service_filters_inheritance_spec.rb +105 -0
  36. data/spec/lib/protobuf/service_loader_spec.rb +88 -0
  37. metadata +49 -77
data/.rubocop_todo.yml CHANGED
@@ -1,30 +1,214 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2015-09-25 12:31:31 -0700 using RuboCop version 0.34.2.
3
+ # on 2020-04-13 09:00:39 +0200 using RuboCop version 0.81.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
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 31
9
+ # RuboCop 0.81 validates this file alone, before it merges it into
10
+ # .rubocop.yml, so it needs its own TargetRubyVersion. Keep it equal to the
11
+ # value in .rubocop.yml.
12
+ AllCops:
13
+ TargetRubyVersion: 2.7
14
+
15
+ # Offense count: 1
16
+ # Cop supports --auto-correct.
17
+ # Configuration parameters: TreatCommentsAsGroupSeparators, Include.
18
+ # Include: **/*.gemspec
19
+ Gemspec/OrderedDependencies:
20
+ Exclude:
21
+ - 'protobuf.gemspec'
22
+
23
+ # Offense count: 2
24
+ # Configuration parameters: Include.
25
+ # Include: **/*.gemspec
26
+ Gemspec/RubyVersionGlobalsUsage:
27
+ Exclude:
28
+ - 'protobuf.gemspec'
29
+
30
+ # Offense count: 2
31
+ # Cop supports --auto-correct.
32
+ Layout/ClosingParenthesisIndentation:
33
+ Exclude:
34
+ - 'spec/lib/protobuf/generators/base_spec.rb'
35
+ - 'spec/lib/protobuf/rpc/service_spec.rb'
36
+
37
+ # Offense count: 42
38
+ # Cop supports --auto-correct.
39
+ Layout/EmptyLineAfterGuardClause:
40
+ Enabled: false
41
+
42
+ # Offense count: 1
43
+ # Cop supports --auto-correct.
44
+ Layout/EmptyLineAfterMagicComment:
45
+ Exclude:
46
+ - 'protobuf.gemspec'
47
+
48
+ # Offense count: 83
49
+ # Cop supports --auto-correct.
50
+ # Configuration parameters: EnforcedStyle.
51
+ # SupportedStyles: empty_lines, no_empty_lines
52
+ Layout/EmptyLinesAroundBlockBody:
53
+ Enabled: false
54
+
55
+ # Offense count: 75
56
+ # Cop supports --auto-correct.
57
+ # Configuration parameters: EnforcedStyle.
58
+ # SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines, beginning_only, ending_only
59
+ Layout/EmptyLinesAroundClassBody:
60
+ Enabled: false
61
+
62
+ # Offense count: 39
63
+ # Cop supports --auto-correct.
64
+ # Configuration parameters: EnforcedStyle.
65
+ # SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines
66
+ Layout/EmptyLinesAroundModuleBody:
67
+ Enabled: false
68
+
69
+ # Offense count: 30
70
+ # Cop supports --auto-correct.
71
+ # Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
72
+ # SupportedHashRocketStyles: key, separator, table
73
+ # SupportedColonStyles: key, separator, table
74
+ # SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
75
+ Layout/HashAlignment:
76
+ Exclude:
77
+ - 'Rakefile'
78
+ - 'lib/protobuf/field.rb'
79
+ - 'lib/protobuf/rpc/connectors/base.rb'
80
+ - 'spec/lib/protobuf/enum_spec.rb'
81
+ - 'spec/lib/protobuf/rpc/middleware/response_encoder_spec.rb'
82
+
83
+ # Offense count: 7
84
+ # Cop supports --auto-correct.
85
+ # Configuration parameters: EnforcedStyle.
86
+ # SupportedStyles: squiggly, active_support, powerpack, unindent
87
+ Layout/HeredocIndentation:
88
+ Exclude:
89
+ - 'spec/lib/protobuf/generators/enum_generator_spec.rb'
90
+ - 'spec/lib/protobuf/generators/file_generator_spec.rb'
91
+ - 'spec/lib/protobuf/generators/service_generator_spec.rb'
92
+
93
+ # Offense count: 2
94
+ # Cop supports --auto-correct.
95
+ # Configuration parameters: EnforcedStyle.
96
+ # SupportedStyles: symmetrical, new_line, same_line
97
+ Layout/MultilineArrayBraceLayout:
98
+ Exclude:
99
+ - 'spec/lib/protobuf/generators/field_generator_spec.rb'
100
+ - 'spec/lib/protobuf/message_spec.rb'
101
+
102
+ # Offense count: 10
103
+ # Cop supports --auto-correct.
104
+ # Configuration parameters: EnforcedStyle.
105
+ # SupportedStyles: symmetrical, new_line, same_line
106
+ Layout/MultilineMethodCallBraceLayout:
107
+ Exclude:
108
+ - 'spec/functional/code_generator_spec.rb'
109
+ - 'spec/lib/protobuf/generators/field_generator_spec.rb'
110
+ - 'spec/lib/protobuf/optionable_spec.rb'
111
+
112
+ # Offense count: 1
113
+ # Cop supports --auto-correct.
114
+ # Configuration parameters: EnforcedStyle, IndentationWidth.
115
+ # SupportedStyles: aligned, indented, indented_relative_to_receiver
116
+ Layout/MultilineMethodCallIndentation:
117
+ Exclude:
118
+ - 'spec/lib/protobuf/generators/file_generator_spec.rb'
119
+
120
+ # Offense count: 1
121
+ # Cop supports --auto-correct.
122
+ Layout/RescueEnsureAlignment:
123
+ Exclude:
124
+ - 'lib/protobuf/rpc/servers/socket/server.rb'
125
+
126
+ # Offense count: 5
127
+ # Cop supports --auto-correct.
128
+ Layout/SpaceAfterNot:
129
+ Exclude:
130
+ - 'lib/protobuf/field/base_field.rb'
131
+ - 'lib/protobuf/rpc/connectors/zmq.rb'
132
+ - 'lib/protobuf/rpc/servers/socket/worker.rb'
133
+ - 'lib/protobuf/tasks/compile.rake'
134
+
135
+ # Offense count: 1
136
+ # Cop supports --auto-correct.
137
+ # Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator.
138
+ # SupportedStylesForExponentOperator: space, no_space
139
+ Layout/SpaceAroundOperators:
140
+ Exclude:
141
+ - 'lib/protobuf/field/base_field.rb'
142
+
143
+ # Offense count: 6
144
+ Lint/DuplicateMethods:
145
+ Exclude:
146
+ - 'lib/protobuf/generators/field_generator.rb'
147
+ - 'lib/protobuf/rpc/buffer.rb'
148
+ - 'lib/protobuf/rpc/stat.rb'
149
+
150
+ # Offense count: 1
151
+ Lint/EmptyWhen:
152
+ Exclude:
153
+ - 'lib/protobuf/rpc/servers/socket/server.rb'
154
+
155
+ # Offense count: 1
156
+ Lint/InterpolationCheck:
157
+ Exclude:
158
+ - 'spec/lib/protobuf/message_spec.rb'
159
+
160
+ # Offense count: 1
161
+ # Configuration parameters: MaximumRangeSize.
162
+ Lint/MissingCopEnableDirective:
163
+ Exclude:
164
+ - 'lib/protobuf/message/fields.rb'
165
+
166
+ # Offense count: 4
167
+ # Cop supports --auto-correct.
168
+ Lint/RedundantCopDisableDirective:
169
+ Exclude:
170
+ - 'lib/protobuf.rb'
171
+ - 'lib/protobuf/message/fields.rb'
172
+
173
+ # Offense count: 5
174
+ # Cop supports --auto-correct.
175
+ Lint/RedundantRequireStatement:
176
+ Exclude:
177
+ - 'lib/protobuf/rpc/servers/zmq/broker.rb'
178
+ - 'lib/protobuf/rpc/servers/zmq/server.rb'
179
+ - 'lib/protobuf/rpc/servers/zmq/worker.rb'
180
+ - 'lib/protobuf/rpc/servers/zmq_runner.rb'
181
+ - 'lib/protobuf/rpc/service_directory.rb'
182
+
183
+ # Offense count: 2
184
+ # Configuration parameters: AllowComments.
185
+ Lint/SuppressedException:
186
+ Exclude:
187
+ - 'lib/protobuf.rb'
188
+
189
+ # Offense count: 44
190
+ # Configuration parameters: IgnoredMethods.
10
191
  Metrics/AbcSize:
11
- Max: 59
192
+ Max: 55
193
+
194
+ # Offense count: 116
195
+ # Configuration parameters: CountComments, ExcludedMethods.
196
+ # ExcludedMethods: refine
197
+ Metrics/BlockLength:
198
+ Max: 742
12
199
 
13
200
  # Offense count: 1
201
+ # Configuration parameters: CountBlocks.
14
202
  Metrics/BlockNesting:
15
203
  Max: 5
16
204
 
17
- # Offense count: 6
205
+ # Offense count: 19
206
+ # Configuration parameters: IgnoredMethods.
18
207
  Metrics/CyclomaticComplexity:
19
208
  Max: 12
20
209
 
21
- # Offense count: 493
22
- # Configuration parameters: AllowURI, URISchemes.
23
- Metrics/LineLength:
24
- Max: 199
25
-
26
- # Offense count: 44
27
- # Configuration parameters: CountComments.
210
+ # Offense count: 65
211
+ # Configuration parameters: CountComments, ExcludedMethods.
28
212
  Metrics/MethodLength:
29
213
  Max: 38
30
214
 
@@ -33,21 +217,73 @@ Metrics/MethodLength:
33
217
  Metrics/ParameterLists:
34
218
  Max: 7
35
219
 
36
- # Offense count: 6
220
+ # Offense count: 18
221
+ # Configuration parameters: IgnoredMethods.
37
222
  Metrics/PerceivedComplexity:
38
- Max: 17
223
+ Max: 13
39
224
 
40
- # Offense count: 1
225
+ # Offense count: 5
226
+ # Configuration parameters: ForbiddenDelimiters.
227
+ # ForbiddenDelimiters: (?-mix:(^|\s)(EO[A-Z]{1}|END)(\s|$))
228
+ Naming/HeredocDelimiterNaming:
229
+ Exclude:
230
+ - 'spec/lib/protobuf/generators/file_generator_spec.rb'
231
+ - 'spec/lib/protobuf/generators/service_generator_spec.rb'
232
+
233
+ # Offense count: 13
234
+ # Configuration parameters: EnforcedStyleForLeadingUnderscores.
235
+ # SupportedStylesForLeadingUnderscores: disallowed, required, optional
236
+ Naming/MemoizedInstanceVariableName:
237
+ Exclude:
238
+ - 'lib/protobuf/field/base_field.rb'
239
+ - 'lib/protobuf/logging.rb'
240
+ - 'lib/protobuf/rpc/client.rb'
241
+ - 'lib/protobuf/rpc/connectors/base.rb'
242
+ - 'lib/protobuf/rpc/connectors/socket.rb'
243
+ - 'lib/protobuf/rpc/connectors/zmq.rb'
244
+ - 'lib/protobuf/rpc/server.rb'
245
+ - 'lib/protobuf/rpc/servers/socket/server.rb'
246
+ - 'lib/protobuf/rpc/servers/socket/worker.rb'
247
+ - 'lib/protobuf/rpc/servers/zmq/server.rb'
248
+ - 'lib/protobuf/rpc/stat.rb'
249
+ - 'spec/support/server.rb'
250
+
251
+ # Offense count: 2
252
+ # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
253
+ # AllowedNames: io, id, to, by, on, in, at, ip, db, os, pp
254
+ Naming/MethodParameterName:
255
+ Exclude:
256
+ - 'lib/protobuf/logging.rb'
257
+ - 'spec/lib/protobuf/rpc/service_filters_spec.rb'
258
+
259
+ # Offense count: 6
41
260
  # Cop supports --auto-correct.
42
- Performance/StringReplacement:
261
+ # Configuration parameters: PreferredName.
262
+ Naming/RescuedExceptionsVariableName:
43
263
  Exclude:
44
- - 'lib/protobuf/rpc/buffer.rb'
264
+ - 'lib/protobuf/rpc/connectors/base.rb'
265
+ - 'lib/protobuf/rpc/middleware/exception_handler.rb'
266
+ - 'lib/protobuf/rpc/middleware/request_decoder.rb'
267
+ - 'lib/protobuf/rpc/middleware/response_encoder.rb'
268
+ - 'lib/protobuf/rpc/service_filters.rb'
45
269
 
46
- Performance/TimesMap:
47
- Enabled: false
270
+ # Offense count: 6
271
+ # Cop supports --auto-correct.
272
+ # Configuration parameters: AutoCorrect, EnforcedStyle.
273
+ # SupportedStyles: nested, compact
274
+ Style/ClassAndModuleChildren:
275
+ Exclude:
276
+ - '**/*.pb.rb'
277
+ - 'spec/lib/protobuf/generators/field_generator_spec.rb'
278
+ - 'spec/lib/protobuf/generators/service_generator_spec.rb'
48
279
 
49
- # Offense count: 127
50
- # Configuration parameters: Exclude.
280
+ # Offense count: 2
281
+ Style/CommentedKeyword:
282
+ Exclude:
283
+ - 'lib/protobuf/rpc/servers/socket_runner.rb'
284
+ - 'lib/protobuf/rpc/servers/zmq_runner.rb'
285
+
286
+ # Offense count: 203
51
287
  Style/Documentation:
52
288
  Enabled: false
53
289
 
@@ -62,84 +298,250 @@ Style/DoubleNegation:
62
298
  - 'lib/protobuf/rpc/servers/zmq/worker.rb'
63
299
  - 'lib/protobuf/rpc/service_directory.rb'
64
300
 
301
+ # Offense count: 9
302
+ # Cop supports --auto-correct.
303
+ Style/EmptyCaseCondition:
304
+ Exclude:
305
+ - 'lib/protobuf/enum.rb'
306
+ - 'lib/protobuf/field/base_field.rb'
307
+ - 'lib/protobuf/rpc/connectors/zmq.rb'
308
+ - 'lib/protobuf/rpc/servers/socket/server.rb'
309
+ - 'lib/protobuf/rpc/servers/socket_runner.rb'
310
+ - 'lib/protobuf/rpc/servers/zmq_runner.rb'
311
+
65
312
  # Offense count: 2
66
313
  # Cop supports --auto-correct.
67
- # Configuration parameters: EnforcedStyle, SupportedStyles.
314
+ # Configuration parameters: EnforcedStyle.
315
+ # SupportedStyles: empty, nil, both
68
316
  Style/EmptyElse:
69
317
  Exclude:
70
318
  - 'lib/protobuf/enum.rb'
71
319
  - 'lib/protobuf/message/fields.rb'
72
320
 
73
- # Offense count: 77
321
+ # Offense count: 1
74
322
  # Cop supports --auto-correct.
75
- # Configuration parameters: EnforcedStyle, SupportedStyles.
76
- Style/EmptyLinesAroundBlockBody:
77
- Enabled: false
323
+ # Configuration parameters: EnforcedStyle.
324
+ # SupportedStyles: compact, expanded
325
+ Style/EmptyMethod:
326
+ Exclude:
327
+ - 'lib/protobuf/code_generator.rb'
328
+
329
+ # Offense count: 3
330
+ # Cop supports --auto-correct.
331
+ Style/Encoding:
332
+ Exclude:
333
+ - '**/*.pb.rb'
334
+ - 'protobuf.gemspec'
335
+ - 'spec/lib/protobuf/field/string_field_spec.rb'
336
+ - 'spec/lib/protobuf/message_spec.rb'
337
+
338
+ # Offense count: 1
339
+ Style/EvalWithLocation:
340
+ Exclude:
341
+ - 'lib/protobuf/message/fields.rb'
342
+
343
+ # Offense count: 2
344
+ # Cop supports --auto-correct.
345
+ Style/ExpandPathArguments:
346
+ Exclude:
347
+ - 'spec/benchmark/tasks.rb'
348
+ - 'spec/lib/protobuf/cli_spec.rb'
78
349
 
79
- # Offense count: 90
350
+ # Offense count: 167
80
351
  # Cop supports --auto-correct.
81
- # Configuration parameters: EnforcedStyle, SupportedStyles.
82
- Style/EmptyLinesAroundClassBody:
352
+ # Configuration parameters: EnforcedStyle.
353
+ # SupportedStyles: always, always_true, never
354
+ Style/FrozenStringLiteralComment:
83
355
  Enabled: false
84
356
 
85
- # Offense count: 50
357
+ # Offense count: 1
358
+ # Configuration parameters: MinBodyLength.
359
+ Style/GuardClause:
360
+ Exclude:
361
+ - 'lib/protobuf/generators/base.rb'
362
+
363
+ # Offense count: 22
86
364
  # Cop supports --auto-correct.
87
- # Configuration parameters: EnforcedStyle, SupportedStyles.
88
- Style/EmptyLinesAroundModuleBody:
365
+ Style/IfUnlessModifier:
89
366
  Enabled: false
90
367
 
91
- # Offense count: 2
92
- Style/IndentationWidth:
368
+ # Offense count: 1
369
+ Style/MethodMissingSuper:
93
370
  Exclude:
94
- - 'protobuf.gemspec'
95
- - 'lib/protobuf/cli.rb'
371
+ - 'lib/protobuf/rpc/client.rb'
96
372
 
97
- # Offense count: 3
98
- Style/ElseAlignment:
373
+ # Offense count: 1
374
+ Style/MissingRespondToMissing:
99
375
  Exclude:
100
- - 'protobuf.gemspec'
101
- - 'lib/protobuf/cli.rb'
376
+ - 'lib/protobuf/rpc/client.rb'
102
377
 
103
- # Offense count: 8
378
+ # Offense count: 17
104
379
  # Cop supports --auto-correct.
105
- # Configuration parameters: AllowForAlignment.
106
- Style/ExtraSpacing:
380
+ Style/MultilineWhenThen:
107
381
  Exclude:
108
- - 'lib/protobuf/rpc/connectors/common.rb'
109
- - 'lib/protobuf/rpc/connectors/socket.rb'
382
+ - 'lib/protobuf/generators/field_generator.rb'
383
+ - 'lib/protobuf/generators/printable.rb'
110
384
  - 'lib/protobuf/rpc/connectors/zmq.rb'
111
- - 'lib/protobuf/rpc/servers/socket/server.rb'
112
- - 'spec/lib/protobuf/rpc/service_directory_spec.rb'
385
+ - 'lib/protobuf/rpc/servers/socket_runner.rb'
386
+ - 'lib/protobuf/rpc/servers/zmq_runner.rb'
387
+
388
+ # Offense count: 1
389
+ Style/MultipleComparison:
390
+ Exclude:
391
+ - 'lib/protobuf/generators/group_generator.rb'
392
+
393
+ # Offense count: 5
394
+ # Cop supports --auto-correct.
395
+ # Configuration parameters: EnforcedStyle.
396
+ # SupportedStyles: literals, strict
397
+ Style/MutableConstant:
398
+ Exclude:
399
+ - 'lib/protobuf/generators/field_generator.rb'
400
+ - 'lib/protobuf/rpc/buffer.rb'
401
+ - 'lib/protobuf/rpc/servers/zmq/util.rb'
113
402
 
114
- # Offense count: 46
403
+ # Offense count: 51
115
404
  # Cop supports --auto-correct.
405
+ # Configuration parameters: Strict.
116
406
  Style/NumericLiterals:
117
407
  MinDigits: 21
118
408
 
409
+ # Offense count: 10
410
+ # Cop supports --auto-correct.
411
+ # Configuration parameters: AutoCorrect, EnforcedStyle, IgnoredMethods.
412
+ # SupportedStyles: predicate, comparison
413
+ Style/NumericPredicate:
414
+ Exclude:
415
+ - 'spec/**/*'
416
+ - 'lib/protobuf/generators/file_generator.rb'
417
+ - 'lib/protobuf/generators/message_generator.rb'
418
+ - 'lib/protobuf/rpc/buffer.rb'
419
+ - 'lib/protobuf/rpc/servers/socket/server.rb'
420
+ - 'lib/protobuf/rpc/servers/zmq/broker.rb'
421
+ - 'lib/protobuf/rpc/servers/zmq/server.rb'
422
+ - 'lib/protobuf/rpc/servers/zmq/worker.rb'
423
+
424
+ # Offense count: 15
425
+ # Cop supports --auto-correct.
426
+ # Configuration parameters: PreferredDelimiters.
427
+ Style/PercentLiteralDelimiters:
428
+ Exclude:
429
+ - 'lib/protobuf/cli.rb'
430
+ - 'spec/lib/protobuf/field/field_array_spec.rb'
431
+ - 'spec/lib/protobuf/rpc/service_directory_spec.rb'
432
+
433
+ # Offense count: 3
434
+ # Cop supports --auto-correct.
435
+ Style/RedundantBegin:
436
+ Exclude:
437
+ - 'lib/protobuf/message/fields.rb'
438
+ - 'lib/protobuf/rpc/servers/zmq/server.rb'
439
+
440
+ # Offense count: 1
441
+ # Cop supports --auto-correct.
442
+ Style/RedundantCondition:
443
+ Exclude:
444
+ - 'lib/protobuf/rpc/connectors/base.rb'
445
+
446
+ # Offense count: 1
447
+ # Cop supports --auto-correct.
448
+ Style/RedundantInterpolation:
449
+ Exclude:
450
+ - 'lib/protobuf.rb'
451
+
452
+ # Offense count: 3
453
+ # Cop supports --auto-correct.
454
+ # Configuration parameters: AllowMultipleReturnValues.
455
+ Style/RedundantReturn:
456
+ Exclude:
457
+ - 'lib/protobuf/field/int64_field.rb'
458
+ - 'lib/protobuf/rpc/connectors/base.rb'
459
+ - 'lib/protobuf/rpc/connectors/zmq.rb'
460
+
461
+ # Offense count: 23
462
+ # Cop supports --auto-correct.
463
+ # Configuration parameters: EnforcedStyle.
464
+ # SupportedStyles: implicit, explicit
465
+ Style/RescueStandardError:
466
+ Exclude:
467
+ - 'lib/protobuf/cli.rb'
468
+ - 'lib/protobuf/field/int64_field.rb'
469
+ - 'lib/protobuf/field/varint_field.rb'
470
+ - 'lib/protobuf/generators/file_generator.rb'
471
+ - 'lib/protobuf/message.rb'
472
+ - 'lib/protobuf/rpc/connectors/base.rb'
473
+ - 'lib/protobuf/rpc/connectors/ping.rb'
474
+ - 'lib/protobuf/rpc/connectors/socket.rb'
475
+ - 'lib/protobuf/rpc/middleware/exception_handler.rb'
476
+ - 'lib/protobuf/rpc/middleware/request_decoder.rb'
477
+ - 'lib/protobuf/rpc/middleware/response_encoder.rb'
478
+ - 'lib/protobuf/rpc/servers/zmq/broker.rb'
479
+ - 'lib/protobuf/rpc/servers/zmq/server.rb'
480
+ - 'lib/protobuf/rpc/servers/zmq/worker.rb'
481
+ - 'lib/protobuf/rpc/service_directory.rb'
482
+
483
+ # Offense count: 9
484
+ # Cop supports --auto-correct.
485
+ # Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods.
486
+ # AllowedMethods: present?, blank?, presence, try, try!
487
+ Style/SafeNavigation:
488
+ Exclude:
489
+ - 'lib/protobuf/generators/field_generator.rb'
490
+ - 'lib/protobuf/generators/service_generator.rb'
491
+ - 'lib/protobuf/message/serialization.rb'
492
+ - 'lib/protobuf/rpc/connectors/base.rb'
493
+ - 'lib/protobuf/rpc/connectors/ping.rb'
494
+ - 'lib/protobuf/rpc/servers/zmq/server.rb'
495
+
496
+ # Offense count: 71
497
+ # Cop supports --auto-correct.
498
+ # Configuration parameters: EnforcedStyle.
499
+ # SupportedStyles: only_raise, only_fail, semantic
119
500
  Style/SignalException:
120
501
  Enabled: false
121
502
 
122
- # Offense count: 473
503
+ # Offense count: 6
504
+ # Cop supports --auto-correct.
505
+ Style/StderrPuts:
506
+ Exclude:
507
+ - 'lib/protobuf/cli.rb'
508
+ - 'lib/protobuf/code_generator.rb'
509
+ - 'lib/protobuf/rpc/servers/zmq/server.rb'
510
+
511
+ # Offense count: 627
123
512
  # Cop supports --auto-correct.
124
- # Configuration parameters: EnforcedStyle, SupportedStyles.
513
+ # Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
514
+ # SupportedStyles: single_quotes, double_quotes
125
515
  Style/StringLiterals:
126
516
  Enabled: false
127
517
 
128
- # Offense count: 7
518
+ # Offense count: 26
129
519
  # Cop supports --auto-correct.
130
- # Configuration parameters: IgnoredMethods.
131
- Style/SymbolProc:
520
+ # Configuration parameters: MinSize.
521
+ # SupportedStyles: percent, brackets
522
+ Style/SymbolArray:
523
+ EnforcedStyle: brackets
524
+
525
+ # Offense count: 4
526
+ # Cop supports --auto-correct.
527
+ Style/UnpackFirst:
132
528
  Exclude:
133
- - 'lib/protobuf/generators/printable.rb'
134
- - 'lib/protobuf/rpc/servers/socket/server.rb'
135
- - 'spec/encoding/all_types_spec.rb'
136
- - 'spec/encoding/extreme_values_spec.rb'
137
- - 'spec/functional/socket_server_spec.rb'
138
- - 'spec/functional/zmq_server_spec.rb'
139
- - 'spec/lib/protobuf/rpc/servers/socket_server_spec.rb'
529
+ - 'lib/protobuf/field/double_field.rb'
530
+ - 'lib/protobuf/field/fixed32_field.rb'
531
+ - 'lib/protobuf/field/float_field.rb'
532
+ - 'lib/protobuf/field/sfixed32_field.rb'
140
533
 
141
534
  # Offense count: 4
142
535
  # Cop supports --auto-correct.
143
536
  # Configuration parameters: WordRegex.
537
+ # SupportedStyles: percent, brackets
144
538
  Style/WordArray:
145
- MinSize: 4
539
+ EnforcedStyle: percent
540
+ MinSize: 3
541
+
542
+ # Offense count: 728
543
+ # Cop supports --auto-correct.
544
+ # Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
545
+ # URISchemes: http, https
546
+ Layout/LineLength:
547
+ Max: 196
data/CHANGES.md CHANGED
@@ -1,5 +1,36 @@
1
1
  # Stable (3.8.x)
2
2
 
3
+ 3.10.10
4
+ -------
5
+ - Decode repeated scalar fields by the wire type of each record, not by the
6
+ `packed` declaration. Packed input (the proto3 default in Go, Java, C++ and
7
+ google-protobuf) for a field without `packed` no longer decodes bools as
8
+ `false`, raises on integers and enums, or drops all but the first
9
+ fixed32/float/double value. (#438, #330, #414)
10
+ - Skip a record whose wire type does not match its known field, as the
11
+ reference parsers do. Before, such a record could decode to a wrong value
12
+ or raise `NoMethodError`/`TypeError` for string, bytes, message, and map
13
+ fields.
14
+ - Decode any non-zero bool varint as `true`.
15
+ - An `int32`, `uint32`, or `sint32` field keeps the low 32 bits of a wider
16
+ varint, as the reference parsers do. Before, a peer that sent an int64 value
17
+ for the field (a compatible schema change) made the whole decode raise
18
+ `TypeError`.
19
+ - Skip a group (wire types 3 and 4, from proto2 groups or editions `DELIMITED`
20
+ encoding) as an unknown field. Before, the decode raised
21
+ `Protobuf::InvalidWireType`.
22
+ - Support Ruby 4.0. CircleCI also tests Ruby 4.0, JRuby 9.4, and JRuby 10.0.
23
+ - Require Ruby >= 3.1 and ActiveSupport >= 6.0.
24
+ - Add `Protobuf::Rpc::ApplicationService`, a base class for application services.
25
+ - `Service.implemented_services` walks all descendants, not only direct subclasses.
26
+ - Add `Protobuf::Railtie`. Set `config.protobuf.services_path` to load that
27
+ directory when the RPC server binds, so dynamic discovery sees lazily loaded
28
+ services.
29
+ - Service filters and `rescue_from` handlers now pass from a parent class to
30
+ its subclasses.
31
+ - Add `PB_SERVICE_PARENT` to set the parent class of generated services.
32
+ - CircleCI tests Ruby 3.1 to 3.4 with Rails 6.0 to 8.1, and runs RuboCop.
33
+
3
34
 
4
35
  3.10.0
5
36
  ------
data/Gemfile CHANGED
@@ -1,3 +1,25 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
+
5
+ # CI sets RAILS_VERSION (for example "~> 6.1.0") to test each supported Rails.
6
+ # railties is also a gemspec development dependency, so only activesupport is
7
+ # pinned here and railties follows it.
8
+ if (rails_version = ENV['RAILS_VERSION'])
9
+ gem 'activesupport', rails_version
10
+ end
11
+
12
+ group :development do
13
+ # debuggers only work in MRI
14
+ if RUBY_ENGINE.to_sym == :ruby
15
+ gem 'pry'
16
+ gem 'pry-byebug'
17
+ gem 'pry-stack_explorer'
18
+
19
+ gem 'ruby-prof'
20
+ gem 'varint'
21
+ elsif RUBY_PLATFORM =~ /java/i
22
+ gem 'fast_blank_java'
23
+ gem 'pry'
24
+ end
25
+ end