gitlab-mail_room 0.0.11 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aed4391d3a022966a3f2adda086e9b2e059d3ce639755c088fb865a3fa694ffc
4
- data.tar.gz: 8c4f102bb223f73f914365d6c77dc7793b2149dbc47ce015e4c888de527d595d
3
+ metadata.gz: d894cd7c411ae358d57bbf83b19f968283d57bc7a933b08372dfa7f4bdae8c3d
4
+ data.tar.gz: cc58d74e461dd0d727377a0dcb5716270c82f54046cce532bf3b4a4766759fe7
5
5
  SHA512:
6
- metadata.gz: 3018e959345d18859c40aae953bfcad1a779136f27cd9284da9a1c2edc44f6fcf5436aba4c2911ba0bb36147e4c066293768539802d4ff040a5136a16530a7cf
7
- data.tar.gz: afd251026ab38a1d54ac2e9fa88252a68f72971caa657b736e936f9151382879e05f2c90aa1a9026efac739cfa01a3604b6f48f542f3d098af8c20a0a59be5eb
6
+ metadata.gz: c83273f42748dd42813b3614a677de3fdfcaf0939b39a04a2be85208b3ded8e8df274db2c29e9fad6f429f688e5fe42266a98a5b52eae21dfe425d318b8258b0
7
+ data.tar.gz: da92b942d53c0b675b803b251d438556a0fd2bb740a75ccfe748a1068cb035a7462966d3a7bac39e979cee2a2b85ae0d4d210e833f89b53a4a4d032634b5e71c
data/.gitlab-ci.yml CHANGED
@@ -19,10 +19,6 @@ services:
19
19
  - gem install bundler --no-document # Bundler is not installed with the image
20
20
  - bundle install -j $(nproc) --path vendor # Install dependencies into ./vendor/ruby
21
21
 
22
- rspec-2.5:
23
- image: "ruby:2.5"
24
- <<: *test
25
-
26
22
  rspec-2.6:
27
23
  image: "ruby:2.6"
28
24
  <<: *test
data/.rubocop.yml ADDED
@@ -0,0 +1,5 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ Style/HashSyntax:
4
+ Enabled: true
5
+ EnforcedStyle: ruby19_no_mixed_keys
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,501 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2021-04-26 06:46:39 UTC using RuboCop version 1.11.0.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 5
10
+ # Cop supports --auto-correct.
11
+ # Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation, Include.
12
+ # Include: **/*.gemspec
13
+ Gemspec/OrderedDependencies:
14
+ Exclude:
15
+ - 'mail_room.gemspec'
16
+
17
+ # Offense count: 1
18
+ # Configuration parameters: Include.
19
+ # Include: **/*.gemspec
20
+ Gemspec/RequiredRubyVersion:
21
+ Exclude:
22
+ - 'mail_room.gemspec'
23
+
24
+ # Offense count: 4
25
+ # Cop supports --auto-correct.
26
+ Layout/BlockEndNewline:
27
+ Exclude:
28
+ - 'spec/lib/delivery/postback_spec.rb'
29
+ - 'spec/lib/delivery/que_spec.rb'
30
+
31
+ # Offense count: 5
32
+ # Cop supports --auto-correct.
33
+ # Configuration parameters: EnforcedStyle, IndentOneStep, IndentationWidth.
34
+ # SupportedStyles: case, end
35
+ Layout/CaseIndentation:
36
+ Exclude:
37
+ - 'lib/mail_room/mailbox.rb'
38
+
39
+ # Offense count: 1
40
+ # Cop supports --auto-correct.
41
+ Layout/EmptyLineAfterMagicComment:
42
+ Exclude:
43
+ - 'mail_room.gemspec'
44
+
45
+ # Offense count: 2
46
+ # Cop supports --auto-correct.
47
+ # Configuration parameters: EnforcedStyle.
48
+ # SupportedStyles: around, only_before
49
+ Layout/EmptyLinesAroundAccessModifier:
50
+ Exclude:
51
+ - 'lib/mail_room/coordinator.rb'
52
+ - 'lib/mail_room/delivery/que.rb'
53
+
54
+ # Offense count: 4
55
+ # Cop supports --auto-correct.
56
+ # Configuration parameters: EnforcedStyle.
57
+ # SupportedStyles: empty_lines, no_empty_lines
58
+ Layout/EmptyLinesAroundBlockBody:
59
+ Exclude:
60
+ - 'spec/lib/crash_handler_spec.rb'
61
+ - 'spec/lib/delivery/sidekiq_spec.rb'
62
+ - 'spec/lib/logger/structured_spec.rb'
63
+
64
+ # Offense count: 1
65
+ # Cop supports --auto-correct.
66
+ # Configuration parameters: EnforcedStyle.
67
+ # SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines, beginning_only, ending_only
68
+ Layout/EmptyLinesAroundClassBody:
69
+ Exclude:
70
+ - 'lib/mail_room/logger/structured.rb'
71
+
72
+ # Offense count: 13
73
+ # Cop supports --auto-correct.
74
+ # Configuration parameters: EnforcedStyle, IndentationWidth.
75
+ # SupportedStyles: special_inside_parentheses, consistent, align_braces
76
+ Layout/FirstHashElementIndentation:
77
+ Exclude:
78
+ - 'spec/lib/delivery/postback_spec.rb'
79
+ - 'spec/lib/delivery/que_spec.rb'
80
+ - 'spec/lib/logger/structured_spec.rb'
81
+
82
+ # Offense count: 5
83
+ # Cop supports --auto-correct.
84
+ # Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
85
+ # SupportedHashRocketStyles: key, separator, table
86
+ # SupportedColonStyles: key, separator, table
87
+ # SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
88
+ Layout/HashAlignment:
89
+ Exclude:
90
+ - 'lib/mail_room/delivery/sidekiq.rb'
91
+
92
+ # Offense count: 2
93
+ # Cop supports --auto-correct.
94
+ # Configuration parameters: AllowDoxygenCommentStyle, AllowGemfileRubyComment.
95
+ Layout/LeadingCommentSpace:
96
+ Exclude:
97
+ - 'lib/mail_room/mailbox.rb'
98
+ - 'spec/lib/arbitration/redis_spec.rb'
99
+
100
+ # Offense count: 4
101
+ # Cop supports --auto-correct.
102
+ Layout/MultilineBlockLayout:
103
+ Exclude:
104
+ - 'spec/lib/delivery/postback_spec.rb'
105
+ - 'spec/lib/delivery/que_spec.rb'
106
+
107
+ # Offense count: 3
108
+ # Cop supports --auto-correct.
109
+ # Configuration parameters: EnforcedStyle.
110
+ # SupportedStyles: space, no_space
111
+ Layout/SpaceAroundEqualsInParameterDefault:
112
+ Exclude:
113
+ - 'lib/mail_room/configuration.rb'
114
+ - 'lib/mail_room/crash_handler.rb'
115
+ - 'lib/mail_room/mailbox.rb'
116
+
117
+ # Offense count: 2
118
+ # Cop supports --auto-correct.
119
+ Layout/SpaceAroundKeyword:
120
+ Exclude:
121
+ - 'lib/mail_room/coordinator.rb'
122
+ - 'lib/mail_room/mailbox_watcher.rb'
123
+
124
+ # Offense count: 2
125
+ # Cop supports --auto-correct.
126
+ # Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator.
127
+ # SupportedStylesForExponentOperator: space, no_space
128
+ Layout/SpaceAroundOperators:
129
+ Exclude:
130
+ - 'lib/mail_room/mailbox.rb'
131
+ - 'spec/lib/arbitration/redis_spec.rb'
132
+
133
+ # Offense count: 7
134
+ # Cop supports --auto-correct.
135
+ # Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
136
+ # SupportedStyles: space, no_space
137
+ # SupportedStylesForEmptyBraces: space, no_space
138
+ Layout/SpaceBeforeBlockBraces:
139
+ Exclude:
140
+ - 'mail_room.gemspec'
141
+ - 'spec/lib/crash_handler_spec.rb'
142
+ - 'spec/lib/mailbox_spec.rb'
143
+
144
+ # Offense count: 50
145
+ # Cop supports --auto-correct.
146
+ # Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
147
+ # SupportedStyles: space, no_space
148
+ # SupportedStylesForEmptyBraces: space, no_space
149
+ Layout/SpaceInsideBlockBraces:
150
+ Exclude:
151
+ - 'lib/mail_room/coordinator.rb'
152
+ - 'spec/lib/cli_spec.rb'
153
+ - 'spec/lib/configuration_spec.rb'
154
+ - 'spec/lib/delivery/letter_opener_spec.rb'
155
+ - 'spec/lib/delivery/logger_spec.rb'
156
+ - 'spec/lib/delivery/postback_spec.rb'
157
+ - 'spec/lib/delivery/que_spec.rb'
158
+ - 'spec/lib/imap/connection_spec.rb'
159
+ - 'spec/lib/mailbox_watcher_spec.rb'
160
+
161
+ # Offense count: 34
162
+ # Cop supports --auto-correct.
163
+ # Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
164
+ # SupportedStyles: space, no_space, compact
165
+ # SupportedStylesForEmptyBraces: space, no_space
166
+ Layout/SpaceInsideHashLiteralBraces:
167
+ Exclude:
168
+ - 'lib/mail_room/arbitration/redis.rb'
169
+ - 'lib/mail_room/mailbox.rb'
170
+ - 'spec/lib/cli_spec.rb'
171
+ - 'spec/lib/mailbox_spec.rb'
172
+
173
+ # Offense count: 1
174
+ # Cop supports --auto-correct.
175
+ # Configuration parameters: EnforcedStyle.
176
+ # SupportedStyles: space, no_space
177
+ Layout/SpaceInsideParens:
178
+ Exclude:
179
+ - 'spec/lib/logger/structured_spec.rb'
180
+
181
+ # Offense count: 1
182
+ # Cop supports --auto-correct.
183
+ # Configuration parameters: EnforcedStyle.
184
+ # SupportedStyles: final_newline, final_blank_line
185
+ Layout/TrailingEmptyLines:
186
+ Exclude:
187
+ - 'spec/lib/delivery/letter_opener_spec.rb'
188
+
189
+ # Offense count: 7
190
+ # Cop supports --auto-correct.
191
+ # Configuration parameters: AllowInHeredoc.
192
+ Layout/TrailingWhitespace:
193
+ Exclude:
194
+ - 'lib/mail_room/coordinator.rb'
195
+ - 'lib/mail_room/imap.rb'
196
+ - 'spec/lib/coordinator_spec.rb'
197
+ - 'spec/lib/delivery/postback_spec.rb'
198
+
199
+ # Offense count: 5
200
+ # Configuration parameters: AllowedMethods.
201
+ # AllowedMethods: enums
202
+ Lint/ConstantDefinitionInBlock:
203
+ Exclude:
204
+ - 'lib/mail_room/mailbox.rb'
205
+
206
+ # Offense count: 1
207
+ Lint/RescueException:
208
+ Exclude:
209
+ - 'lib/mail_room/cli.rb'
210
+
211
+ # Offense count: 1
212
+ # Cop supports --auto-correct.
213
+ # Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods.
214
+ Lint/UnusedMethodArgument:
215
+ Exclude:
216
+ - 'lib/mail_room/logger/structured.rb'
217
+
218
+ # Offense count: 4
219
+ # Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
220
+ Metrics/AbcSize:
221
+ Max: 27
222
+
223
+ # Offense count: 27
224
+ # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
225
+ # IgnoredMethods: refine
226
+ Metrics/BlockLength:
227
+ Max: 145
228
+
229
+ # Offense count: 3
230
+ # Configuration parameters: CountComments, CountAsOne.
231
+ Metrics/ClassLength:
232
+ Max: 151
233
+
234
+ # Offense count: 1
235
+ # Configuration parameters: IgnoredMethods.
236
+ Metrics/CyclomaticComplexity:
237
+ Max: 8
238
+
239
+ # Offense count: 13
240
+ # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
241
+ Metrics/MethodLength:
242
+ Max: 22
243
+
244
+ # Offense count: 1
245
+ # Configuration parameters: CountComments, CountAsOne.
246
+ Metrics/ModuleLength:
247
+ Max: 172
248
+
249
+ # Offense count: 1
250
+ Naming/AccessorMethodName:
251
+ Exclude:
252
+ - 'lib/mail_room/configuration.rb'
253
+
254
+ # Offense count: 1
255
+ # Cop supports --auto-correct.
256
+ Security/YAMLLoad:
257
+ Exclude:
258
+ - 'lib/mail_room/configuration.rb'
259
+
260
+ # Offense count: 2
261
+ # Configuration parameters: EnforcedStyle, AllowModifiersOnSymbols.
262
+ # SupportedStyles: inline, group
263
+ Style/AccessModifierDeclarations:
264
+ Exclude:
265
+ - 'lib/mail_room/arbitration.rb'
266
+ - 'lib/mail_room/delivery.rb'
267
+
268
+ # Offense count: 1
269
+ # Cop supports --auto-correct.
270
+ # Configuration parameters: EnforcedStyle.
271
+ # SupportedStyles: prefer_alias, prefer_alias_method
272
+ Style/Alias:
273
+ Exclude:
274
+ - 'lib/mail_room/coordinator.rb'
275
+
276
+ # Offense count: 14
277
+ # Cop supports --auto-correct.
278
+ # Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, IgnoredMethods, AllowBracesOnProceduralOneLiners, BracesRequiredMethods.
279
+ # SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
280
+ # ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
281
+ # FunctionalMethods: let, let!, subject, watch
282
+ # IgnoredMethods: lambda, proc, it
283
+ Style/BlockDelimiters:
284
+ Exclude:
285
+ - 'spec/lib/arbitration/redis_spec.rb'
286
+ - 'spec/lib/delivery/postback_spec.rb'
287
+ - 'spec/lib/delivery/que_spec.rb'
288
+ - 'spec/lib/delivery/sidekiq_spec.rb'
289
+
290
+ # Offense count: 12
291
+ Style/Documentation:
292
+ Exclude:
293
+ - 'spec/**/*'
294
+ - 'test/**/*'
295
+ - 'lib/mail_room.rb'
296
+ - 'lib/mail_room/arbitration.rb'
297
+ - 'lib/mail_room/arbitration/noop.rb'
298
+ - 'lib/mail_room/arbitration/redis.rb'
299
+ - 'lib/mail_room/connection.rb'
300
+ - 'lib/mail_room/crash_handler.rb'
301
+ - 'lib/mail_room/delivery.rb'
302
+ - 'lib/mail_room/imap/connection.rb'
303
+ - 'lib/mail_room/imap/message.rb'
304
+ - 'lib/mail_room/logger/structured.rb'
305
+ - 'lib/mail_room/message.rb'
306
+ - 'lib/mail_room/microsoft_graph/connection.rb'
307
+
308
+ # Offense count: 2
309
+ # Cop supports --auto-correct.
310
+ # Configuration parameters: EnforcedStyle.
311
+ # SupportedStyles: compact, expanded
312
+ Style/EmptyMethod:
313
+ Exclude:
314
+ - 'lib/mail_room/arbitration/noop.rb'
315
+ - 'lib/mail_room/delivery/noop.rb'
316
+
317
+ # Offense count: 1
318
+ # Cop supports --auto-correct.
319
+ Style/Encoding:
320
+ Exclude:
321
+ - 'mail_room.gemspec'
322
+
323
+ # Offense count: 2
324
+ # Cop supports --auto-correct.
325
+ Style/ExpandPathArguments:
326
+ Exclude:
327
+ - 'mail_room.gemspec'
328
+ - 'spec/spec_helper.rb'
329
+
330
+ # Offense count: 38
331
+ # Cop supports --auto-correct.
332
+ # Configuration parameters: EnforcedStyle.
333
+ # SupportedStyles: always, always_true, never
334
+ Style/FrozenStringLiteralComment:
335
+ Enabled: false
336
+
337
+ # Offense count: 5
338
+ # Cop supports --auto-correct.
339
+ Style/GlobalStdStream:
340
+ Exclude:
341
+ - 'lib/mail_room/crash_handler.rb'
342
+ - 'lib/mail_room/delivery/logger.rb'
343
+ - 'lib/mail_room/mailbox.rb'
344
+ - 'spec/lib/delivery/logger_spec.rb'
345
+
346
+ # Offense count: 3
347
+ # Configuration parameters: MinBodyLength.
348
+ Style/GuardClause:
349
+ Exclude:
350
+ - 'lib/mail_room/configuration.rb'
351
+ - 'lib/mail_room/imap/connection.rb'
352
+ - 'lib/mail_room/mailbox_watcher.rb'
353
+
354
+ # Offense count: 1
355
+ # Cop supports --auto-correct.
356
+ # Configuration parameters: EnforcedStyle, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
357
+ # SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
358
+ Style/HashSyntax:
359
+ Exclude:
360
+ - 'spec/lib/microsoft_graph/connection_spec.rb'
361
+
362
+ # Offense count: 1
363
+ # Cop supports --auto-correct.
364
+ Style/IfUnlessModifier:
365
+ Exclude:
366
+ - 'lib/mail_room/mailbox_watcher.rb'
367
+
368
+ # Offense count: 5
369
+ # Cop supports --auto-correct.
370
+ # Configuration parameters: EnforcedStyle.
371
+ # SupportedStyles: literals, strict
372
+ Style/MutableConstant:
373
+ Exclude:
374
+ - 'lib/mail_room/crash_handler.rb'
375
+ - 'lib/mail_room/mailbox.rb'
376
+ - 'lib/mail_room/version.rb'
377
+ - 'spec/spec_helper.rb'
378
+
379
+ # Offense count: 1
380
+ # Cop supports --auto-correct.
381
+ # Configuration parameters: EnforcedStyle, IgnoredMethods.
382
+ # SupportedStyles: predicate, comparison
383
+ Style/NumericPredicate:
384
+ Exclude:
385
+ - 'spec/**/*'
386
+ - 'lib/mail_room/imap/connection.rb'
387
+
388
+ # Offense count: 2
389
+ # Cop supports --auto-correct.
390
+ # Configuration parameters: EnforcedStyle.
391
+ # SupportedStyles: short, verbose
392
+ Style/PreferredHashMethods:
393
+ Exclude:
394
+ - 'lib/mail_room/configuration.rb'
395
+ - 'lib/mail_room/mailbox.rb'
396
+
397
+ # Offense count: 1
398
+ # Cop supports --auto-correct.
399
+ # Configuration parameters: EnforcedStyle, AllowedCompactTypes.
400
+ # SupportedStyles: compact, exploded
401
+ Style/RaiseArgs:
402
+ Exclude:
403
+ - 'lib/mail_room/logger/structured.rb'
404
+
405
+ # Offense count: 2
406
+ # Cop supports --auto-correct.
407
+ Style/RedundantPercentQ:
408
+ Exclude:
409
+ - 'mail_room.gemspec'
410
+
411
+ # Offense count: 7
412
+ # Cop supports --auto-correct.
413
+ Style/RedundantSelf:
414
+ Exclude:
415
+ - 'lib/mail_room/configuration.rb'
416
+ - 'lib/mail_room/coordinator.rb'
417
+ - 'lib/mail_room/mailbox.rb'
418
+ - 'lib/mail_room/mailbox_watcher.rb'
419
+
420
+ # Offense count: 1
421
+ # Cop supports --auto-correct.
422
+ # Configuration parameters: EnforcedStyle.
423
+ # SupportedStyles: implicit, explicit
424
+ Style/RescueStandardError:
425
+ Exclude:
426
+ - 'lib/mail_room/configuration.rb'
427
+
428
+ # Offense count: 1
429
+ # Cop supports --auto-correct.
430
+ # Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods.
431
+ # AllowedMethods: present?, blank?, presence, try, try!
432
+ Style/SafeNavigation:
433
+ Exclude:
434
+ - 'lib/mail_room/mailbox_watcher.rb'
435
+
436
+ # Offense count: 1
437
+ # Cop supports --auto-correct.
438
+ # Configuration parameters: EnforcedStyle.
439
+ # SupportedStyles: use_perl_names, use_english_names
440
+ Style/SpecialGlobalVars:
441
+ Exclude:
442
+ - 'mail_room.gemspec'
443
+
444
+ # Offense count: 1
445
+ # Cop supports --auto-correct.
446
+ Style/StringConcatenation:
447
+ Exclude:
448
+ - 'lib/mail_room/logger/structured.rb'
449
+
450
+ # Offense count: 135
451
+ # Cop supports --auto-correct.
452
+ # Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
453
+ # SupportedStyles: single_quotes, double_quotes
454
+ Style/StringLiterals:
455
+ Enabled: false
456
+
457
+ # Offense count: 4
458
+ # Cop supports --auto-correct.
459
+ # Configuration parameters: EnforcedStyle, MinSize.
460
+ # SupportedStyles: percent, brackets
461
+ Style/SymbolArray:
462
+ Exclude:
463
+ - 'lib/mail_room/mailbox.rb'
464
+ - 'spec/lib/logger/structured_spec.rb'
465
+
466
+ # Offense count: 2
467
+ # Cop supports --auto-correct.
468
+ # Configuration parameters: EnforcedStyleForMultiline.
469
+ # SupportedStylesForMultiline: comma, consistent_comma, no_comma
470
+ Style/TrailingCommaInHashLiteral:
471
+ Exclude:
472
+ - 'spec/lib/mailbox_spec.rb'
473
+ - 'spec/spec_helper.rb'
474
+
475
+ # Offense count: 1
476
+ # Cop supports --auto-correct.
477
+ Style/WhileUntilDo:
478
+ Exclude:
479
+ - 'lib/mail_room/mailbox_watcher.rb'
480
+
481
+ # Offense count: 2
482
+ # Cop supports --auto-correct.
483
+ Style/WhileUntilModifier:
484
+ Exclude:
485
+ - 'lib/mail_room/coordinator.rb'
486
+ - 'lib/mail_room/mailbox_watcher.rb'
487
+
488
+ # Offense count: 3
489
+ # Cop supports --auto-correct.
490
+ # Configuration parameters: WordRegex.
491
+ # SupportedStyles: percent, brackets
492
+ Style/WordArray:
493
+ EnforcedStyle: percent
494
+ MinSize: 3
495
+
496
+ # Offense count: 6
497
+ # Cop supports --auto-correct.
498
+ # Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
499
+ # URISchemes: http, https
500
+ Layout/LineLength:
501
+ Max: 177
data/.travis.yml CHANGED
@@ -6,6 +6,12 @@ rvm:
6
6
  - 3.0
7
7
  - truffleruby
8
8
  services:
9
- - redis-server
10
- script: bundle exec rspec spec
11
- sudo: false
9
+ - redis
10
+ script:
11
+ - bundle exec rspec spec
12
+
13
+ jobs:
14
+ - language: ruby
15
+ rvm: 2.7
16
+ script:
17
+ - bundle exec rubocop
data/Rakefile CHANGED
@@ -3,4 +3,4 @@ require 'rspec/core/rake_task'
3
3
 
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
 
6
- task :default => :spec
6
+ task default: :spec
@@ -31,7 +31,7 @@ module MailRoom
31
31
  # Any subsequent failure in the instance which gets the lock will be dealt
32
32
  # with by the expiration, at which time another instance can pick up the
33
33
  # message and try again.
34
- client.set(key, 1, {:nx => true, :ex => expiration})
34
+ client.set(key, 1, {nx: true, ex: expiration})
35
35
  end
36
36
 
37
37
  private
@@ -16,8 +16,6 @@ module MailRoom
16
16
  raise NotImplementedError
17
17
  end
18
18
 
19
- def quit
20
- raise NotImplementedError
21
- end
19
+ def quit; end
22
20
  end
23
21
  end
@@ -24,7 +24,7 @@ module MailRoom
24
24
  # Trigger `LetterOpener` to deliver our message
25
25
  # @param message [String] the email message as a string, RFC822 format
26
26
  def deliver(message)
27
- method = ::LetterOpener::DeliveryMethod.new(:location => @delivery_options.location)
27
+ method = ::LetterOpener::DeliveryMethod.new(location: @delivery_options.location)
28
28
  method.deliver!(Mail.read_from_string(message))
29
29
 
30
30
  true
@@ -51,20 +51,20 @@ module MailRoom
51
51
 
52
52
  # Default attributes for the mailbox configuration
53
53
  DEFAULTS = {
54
- :search_command => 'UNSEEN',
55
- :delivery_method => 'postback',
56
- :host => 'imap.gmail.com',
57
- :port => 993,
58
- :ssl => true,
59
- :start_tls => false,
60
- :limit_max_unread => 0,
61
- :idle_timeout => IMAP_IDLE_TIMEOUT,
62
- :delete_after_delivery => false,
63
- :expunge_deleted => false,
64
- :delivery_options => {},
65
- :arbitration_method => 'noop',
66
- :arbitration_options => {},
67
- :logger => {}
54
+ search_command: 'UNSEEN',
55
+ delivery_method: 'postback',
56
+ host: 'imap.gmail.com',
57
+ port: 993,
58
+ ssl: true,
59
+ start_tls: false,
60
+ limit_max_unread: 0,
61
+ idle_timeout: IMAP_IDLE_TIMEOUT,
62
+ delete_after_delivery: false,
63
+ expunge_deleted: false,
64
+ delivery_options: {},
65
+ arbitration_method: 'noop',
66
+ arbitration_options: {},
67
+ logger: {}
68
68
  }
69
69
 
70
70
  # Store the configuration and require the appropriate delivery method
@@ -32,7 +32,7 @@ module MailRoom
32
32
  @mailbox.logger.warn({ context: @mailbox.context, action: 'Too many requests, backing off...', backoff_s: backoff_secs, error: e.message, error_backtrace: e.backtrace })
33
33
 
34
34
  backoff
35
- rescue OAuth2::Error, IOError => e
35
+ rescue IOError => e
36
36
  @mailbox.logger.warn({ context: @mailbox.context, action: 'Disconnected. Resetting...', error: e.message, error_backtrace: e.backtrace })
37
37
 
38
38
  reset
@@ -166,8 +166,9 @@ module MailRoom
166
166
  def get(url)
167
167
  response = token.get(url, { raise_errors: false })
168
168
 
169
+ # https://docs.microsoft.com/en-us/graph/errors
169
170
  case response.status
170
- when 429
171
+ when 509, 429
171
172
  raise TooManyRequestsError
172
173
  when 400..599
173
174
  raise OAuth2::Error, response
@@ -1,4 +1,4 @@
1
1
  module MailRoom
2
2
  # Current version of gitlab-mail_room gem
3
- VERSION = "0.0.11"
3
+ VERSION = "0.0.12"
4
4
  end
data/mail_room.gemspec CHANGED
@@ -22,6 +22,7 @@ Gem::Specification.new do |gem|
22
22
 
23
23
  gem.add_development_dependency "rake"
24
24
  gem.add_development_dependency "rspec", "~> 3.9"
25
+ gem.add_development_dependency "rubocop", "~> 1.11"
25
26
  gem.add_development_dependency "mocha", "~> 1.11"
26
27
  gem.add_development_dependency "simplecov"
27
28
  gem.add_development_dependency "webrick", "~> 1.6"
data/spec/lib/cli_spec.rb CHANGED
@@ -2,8 +2,8 @@ require 'spec_helper'
2
2
 
3
3
  describe MailRoom::CLI do
4
4
  let(:config_path) {File.expand_path('../fixtures/test_config.yml', File.dirname(__FILE__))}
5
- let!(:configuration) {MailRoom::Configuration.new({:config_path => config_path})}
6
- let(:coordinator) {stub(:run => true, :quit => true)}
5
+ let!(:configuration) {MailRoom::Configuration.new({config_path: config_path})}
6
+ let(:coordinator) {stub(run: true, quit: true)}
7
7
  let(:configuration_args) { anything }
8
8
  let(:coordinator_args) { [anything, anything] }
9
9
 
@@ -17,7 +17,7 @@ describe MailRoom::CLI do
17
17
 
18
18
  context 'with configuration args' do
19
19
  let(:configuration_args) do
20
- {:config_path => 'a path'}
20
+ {config_path: 'a path'}
21
21
  end
22
22
 
23
23
  it 'parses arguments into configuration' do
@@ -5,7 +5,7 @@ describe MailRoom::Configuration do
5
5
 
6
6
  describe '#initalize' do
7
7
  context 'with config_path' do
8
- let(:configuration) { MailRoom::Configuration.new(:config_path => config_path) }
8
+ let(:configuration) { MailRoom::Configuration.new(config_path: config_path) }
9
9
 
10
10
  it 'parses yaml into mailbox objects' do
11
11
  MailRoom::Mailbox.stubs(:new).returns('mailbox1', 'mailbox2')
@@ -3,7 +3,7 @@ require 'mail_room/delivery/letter_opener'
3
3
 
4
4
  describe MailRoom::Delivery::LetterOpener do
5
5
  describe '#deliver' do
6
- let(:mailbox) {build_mailbox(:location => '/tmp/somewhere')}
6
+ let(:mailbox) {build_mailbox(location: '/tmp/somewhere')}
7
7
  let(:delivery_method) {stub(:deliver!)}
8
8
  let(:mail) {stub}
9
9
 
@@ -13,7 +13,7 @@ describe MailRoom::Delivery::LetterOpener do
13
13
  end
14
14
 
15
15
  it 'creates a new LetterOpener::DeliveryMethod' do
16
- ::LetterOpener::DeliveryMethod.expects(:new).with(:location => '/tmp/somewhere').returns(delivery_method)
16
+ ::LetterOpener::DeliveryMethod.expects(:new).with(location: '/tmp/somewhere').returns(delivery_method)
17
17
 
18
18
  MailRoom::Delivery::LetterOpener.new(mailbox).deliver('a message')
19
19
  end
@@ -16,7 +16,7 @@ describe MailRoom::Delivery::Logger do
16
16
  end
17
17
 
18
18
  context "with a log path" do
19
- let(:mailbox) {build_mailbox(:log_path => '/var/log/mail-room.log')}
19
+ let(:mailbox) {build_mailbox(log_path: '/var/log/mail-room.log')}
20
20
 
21
21
  it 'creates a new file to append to' do
22
22
  file = stub(:sync=)
@@ -5,8 +5,8 @@ describe MailRoom::Delivery::Postback do
5
5
  describe '#deliver' do
6
6
  context 'with token auth delivery' do
7
7
  let(:mailbox) {build_mailbox({
8
- :delivery_url => 'http://localhost/inbox',
9
- :delivery_token => 'abcdefg'
8
+ delivery_url: 'http://localhost/inbox',
9
+ delivery_token: 'abcdefg'
10
10
  })}
11
11
 
12
12
  let(:delivery_options) {
@@ -30,10 +30,10 @@ describe MailRoom::Delivery::Postback do
30
30
 
31
31
  context 'with basic auth delivery options' do
32
32
  let(:mailbox) {build_mailbox({
33
- :delivery_options => {
34
- :url => 'http://localhost/inbox',
35
- :username => 'user1',
36
- :password => 'password123abc'
33
+ delivery_options: {
34
+ url: 'http://localhost/inbox',
35
+ username: 'user1',
36
+ password: 'password123abc'
37
37
  }
38
38
  })}
39
39
 
@@ -57,11 +57,11 @@ describe MailRoom::Delivery::Postback do
57
57
 
58
58
  context 'with content type in the delivery options' do
59
59
  let(:mailbox) {build_mailbox({
60
- :delivery_options => {
61
- :url => 'http://localhost/inbox',
62
- :username => 'user1',
63
- :password => 'password123abc',
64
- :content_type => 'text/plain'
60
+ delivery_options: {
61
+ url: 'http://localhost/inbox',
62
+ username: 'user1',
63
+ password: 'password123abc',
64
+ content_type: 'text/plain'
65
65
  }
66
66
  })}
67
67
 
@@ -17,9 +17,9 @@ describe MailRoom::Mailbox do
17
17
  describe "#deliver" do
18
18
  context "with arbitration_method of noop" do
19
19
  it 'arbitrates with a Noop instance' do
20
- mailbox = build_mailbox({:arbitration_method => 'noop'})
20
+ mailbox = build_mailbox({arbitration_method: 'noop'})
21
21
  noop = stub(:deliver?)
22
- MailRoom::Arbitration['noop'].stubs(:new => noop)
22
+ MailRoom::Arbitration['noop'].stubs(new: noop)
23
23
 
24
24
  uid = 123
25
25
 
@@ -31,9 +31,9 @@ describe MailRoom::Mailbox do
31
31
 
32
32
  context "with arbitration_method of redis" do
33
33
  it 'arbitrates with a Redis instance' do
34
- mailbox = build_mailbox({:arbitration_method => 'redis'})
34
+ mailbox = build_mailbox({arbitration_method: 'redis'})
35
35
  redis = stub(:deliver?)
36
- MailRoom::Arbitration['redis'].stubs(:new => redis)
36
+ MailRoom::Arbitration['redis'].stubs(new: redis)
37
37
  uid = 123
38
38
  redis.expects(:deliver?).with(uid)
39
39
 
@@ -43,9 +43,9 @@ describe MailRoom::Mailbox do
43
43
 
44
44
  context "with delivery_method of noop" do
45
45
  it 'delivers with a Noop instance' do
46
- mailbox = build_mailbox({:delivery_method => 'noop'})
46
+ mailbox = build_mailbox({delivery_method: 'noop'})
47
47
  noop = stub(:deliver)
48
- MailRoom::Delivery['noop'].stubs(:new => noop)
48
+ MailRoom::Delivery['noop'].stubs(new: noop)
49
49
 
50
50
  noop.expects(:deliver).with(sample_message.body)
51
51
 
@@ -55,9 +55,9 @@ describe MailRoom::Mailbox do
55
55
 
56
56
  context "with delivery_method of logger" do
57
57
  it 'delivers with a Logger instance' do
58
- mailbox = build_mailbox({:delivery_method => 'logger'})
58
+ mailbox = build_mailbox({delivery_method: 'logger'})
59
59
  logger = stub(:deliver)
60
- MailRoom::Delivery['logger'].stubs(:new => logger)
60
+ MailRoom::Delivery['logger'].stubs(new: logger)
61
61
 
62
62
  logger.expects(:deliver).with(sample_message.body)
63
63
 
@@ -67,9 +67,9 @@ describe MailRoom::Mailbox do
67
67
 
68
68
  context "with delivery_method of postback" do
69
69
  it 'delivers with a Postback instance' do
70
- mailbox = build_mailbox({:delivery_method => 'postback'})
70
+ mailbox = build_mailbox({delivery_method: 'postback'})
71
71
  postback = stub(:deliver)
72
- MailRoom::Delivery['postback'].stubs(:new => postback)
72
+ MailRoom::Delivery['postback'].stubs(new: postback)
73
73
 
74
74
  postback.expects(:deliver).with(sample_message.body)
75
75
 
@@ -79,9 +79,9 @@ describe MailRoom::Mailbox do
79
79
 
80
80
  context "with delivery_method of letter_opener" do
81
81
  it 'delivers with a LetterOpener instance' do
82
- mailbox = build_mailbox({:delivery_method => 'letter_opener'})
82
+ mailbox = build_mailbox({delivery_method: 'letter_opener'})
83
83
  letter_opener = stub(:deliver)
84
- MailRoom::Delivery['letter_opener'].stubs(:new => letter_opener)
84
+ MailRoom::Delivery['letter_opener'].stubs(new: letter_opener)
85
85
 
86
86
  letter_opener.expects(:deliver).with(sample_message.body)
87
87
 
@@ -93,7 +93,7 @@ describe MailRoom::Mailbox do
93
93
  it "doesn't deliver the message" do
94
94
  mailbox = build_mailbox({ name: "magic mailbox", delivery_method: 'noop' })
95
95
  noop = stub(:deliver)
96
- MailRoom::Delivery['noop'].stubs(:new => noop)
96
+ MailRoom::Delivery['noop'].stubs(new: noop)
97
97
  noop.expects(:deliver).never
98
98
 
99
99
  mailbox.deliver(MailRoom::Message.new(uid: 1234, body: nil))
@@ -102,9 +102,9 @@ describe MailRoom::Mailbox do
102
102
 
103
103
  context "with ssl options hash" do
104
104
  it 'replaces verify mode with constant' do
105
- mailbox = build_mailbox({:ssl => {:verify_mode => :none}})
105
+ mailbox = build_mailbox({ssl: {verify_mode: :none}})
106
106
 
107
- expect(mailbox.ssl_options).to eq({:verify_mode => OpenSSL::SSL::VERIFY_NONE})
107
+ expect(mailbox.ssl_options).to eq({verify_mode: OpenSSL::SSL::VERIFY_NONE})
108
108
  end
109
109
  end
110
110
 
@@ -132,8 +132,8 @@ describe MailRoom::Mailbox do
132
132
  describe "#validate!" do
133
133
  context "with missing configuration" do
134
134
  it 'raises an error' do
135
- expect { build_mailbox({:name => nil}) }.to raise_error(MailRoom::ConfigurationError)
136
- expect { build_mailbox({:host => nil}) }.to raise_error(MailRoom::ConfigurationError)
135
+ expect { build_mailbox({name: nil}) }.to raise_error(MailRoom::ConfigurationError)
136
+ expect { build_mailbox({host: nil}) }.to raise_error(MailRoom::ConfigurationError)
137
137
  end
138
138
  end
139
139
 
@@ -12,7 +12,7 @@ describe MailRoom::MailboxWatcher do
12
12
  end
13
13
 
14
14
  describe '#run' do
15
- let(:imap) {stub(:login => true, :select => true)}
15
+ let(:imap) {stub(login: true, select: true)}
16
16
  let(:watcher) {MailRoom::MailboxWatcher.new(mailbox)}
17
17
 
18
18
  before :each do
@@ -34,7 +34,7 @@ describe MailRoom::MailboxWatcher do
34
34
  end
35
35
 
36
36
  describe '#quit' do
37
- let(:imap) {stub(:login => true, :select => true)}
37
+ let(:imap) {stub(login: true, select: true)}
38
38
  let(:watcher) {MailRoom::MailboxWatcher.new(mailbox)}
39
39
 
40
40
  before :each do
@@ -143,9 +143,7 @@ describe MailRoom::MicrosoftGraph::Connection do
143
143
  end
144
144
  end
145
145
 
146
- context 'too many requests' do
147
- let(:status) { 429 }
148
-
146
+ shared_examples 'request backoff' do
149
147
  it 'backs off' do
150
148
  connection.expects(:backoff)
151
149
 
@@ -156,6 +154,18 @@ describe MailRoom::MicrosoftGraph::Connection do
156
154
  end
157
155
  end
158
156
 
157
+ context 'too many requests' do
158
+ let(:status) { 429 }
159
+
160
+ it_behaves_like 'request backoff'
161
+ end
162
+
163
+ context 'too much bandwidth' do
164
+ let(:status) { 509 }
165
+
166
+ it_behaves_like 'request backoff'
167
+ end
168
+
159
169
  context 'invalid JSON response' do
160
170
  let(:body) { 'this is something' }
161
171
 
@@ -170,13 +180,10 @@ describe MailRoom::MicrosoftGraph::Connection do
170
180
  context '500 error' do
171
181
  let(:status) { 500 }
172
182
 
173
- it 'resets the state and logs a warning' do
174
- connection.expects(:reset)
175
- connection.expects(:setup)
176
- mailbox.logger.expects(:warn)
177
-
183
+ it 'terminates due to error' do
178
184
  connection.on_new_message {}
179
- connection.wait
185
+
186
+ expect { connection.wait }.to raise_error(OAuth2::Error)
180
187
  end
181
188
  end
182
189
  end
data/spec/spec_helper.rb CHANGED
@@ -22,9 +22,9 @@ RSpec.configure do |config|
22
22
  end
23
23
 
24
24
  REQUIRED_MAILBOX_DEFAULTS = {
25
- :name => "inbox",
26
- :email => "user@example.com",
27
- :password => "password123"
25
+ name: "inbox",
26
+ email: "user@example.com",
27
+ password: "password123"
28
28
  }
29
29
 
30
30
  REQUIRED_MICROSOFT_GRAPH_DEFAULTS = {
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab-mail_room
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tony Pitale
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-30 00:00:00.000000000 Z
11
+ date: 2021-05-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-imap
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '3.9'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1.11'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.11'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: mocha
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -231,6 +245,8 @@ files:
231
245
  - ".gitignore"
232
246
  - ".gitlab-ci.yml"
233
247
  - ".gitlab/issue_templates/Release.md"
248
+ - ".rubocop.yml"
249
+ - ".rubocop_todo.yml"
234
250
  - ".ruby-version"
235
251
  - ".travis.yml"
236
252
  - CHANGELOG.md