marty 8.2.0 → 8.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/.gitlab-ci.yml +40 -2
  3. data/.rubocop.yml +1 -1
  4. data/.rubocop_todo.yml +109 -137
  5. data/Gemfile +1 -1
  6. data/app/components/marty/extras/layout.rb +2 -2
  7. data/app/components/marty/user_view.rb +1 -1
  8. data/app/components/marty/users/user_view.rb +1 -1
  9. data/app/controllers/marty/rpc_controller.rb +3 -1
  10. data/app/models/marty/base_rule.rb +2 -1
  11. data/app/models/marty/data_grid.rb +1 -1
  12. data/app/models/marty/delorean_rule.rb +1 -1
  13. data/app/models/marty/name_validator.rb +1 -1
  14. data/app/models/marty/pg_enum.rb +6 -2
  15. data/app/services/marty/data_grid/constraint.rb +1 -1
  16. data/db/migrate/200_create_marty_event_operation_enum.rb +1 -1
  17. data/db/migrate/502_add_promise_type_enum.rb +1 -1
  18. data/db/migrate/507_migrate_marty_roles_to_enum.rb +1 -1
  19. data/db/migrate/519_create_marty_notifications_event_types.rb +1 -1
  20. data/lib/marty/api/base.rb +2 -2
  21. data/lib/marty/data_conversion.rb +1 -1
  22. data/lib/marty/json_schema.rb +1 -1
  23. data/lib/marty/migrations.rb +2 -2
  24. data/lib/marty/promise_proxy.rb +1 -1
  25. data/lib/marty/version.rb +1 -1
  26. data/spec/controllers/rpc_controller_spec.rb +9 -0
  27. data/spec/dummy/db/migrate/20171220150101_add_rule_type_enums.rb +1 -1
  28. data/spec/features/data_grid_spec.rb +2 -2
  29. data/spec/fixtures/misc/struct_compare_tests.txt +15 -0
  30. data/spec/lib/json_schema_spec.rb +8 -0
  31. data/spec/models/data_grid_spec.rb +1 -1
  32. data/spec/support/components/netzke_combobox.rb +1 -1
  33. data/spec/support/components/netzke_grid.rb +1 -1
  34. data/spec/support/structure_compare.rb +27 -9
  35. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ef38a20a14482c03a791b80eb8743f9764151a8e8d09c682c76ffeea62d76828
4
- data.tar.gz: 480f31e3d956e235fd4941be08c209c05a7c338d3fbdeb6d2b85a4d4af7b0c28
3
+ metadata.gz: 6a089e78541222d60d9d84b7339c0fdefc8c87f445f0943a471732167e6946e2
4
+ data.tar.gz: cde4b147a1f9d753327c09665df1aa2045f887c9a6d0cafd0236227ceff3c7f9
5
5
  SHA512:
6
- metadata.gz: 5263a4562cfa44272654a399ef3f5e2f52cb95e27fd027c130b0477b93dad83d1b83631d5efc8946344ed5485ef5b654980282882580fd472687fd99d6b71ddc
7
- data.tar.gz: 07e53433346be6dbd718fa631aa7535179ec944139ebbcb6fd69ef9b5182a175dad233df397ca14300581da995d553a667dbb0126e6f988ea3e5339e4fc365aa
6
+ metadata.gz: 42d06eccfc9294f7151ab41f12e6a8970c0c086fe8d6cf492c3520d82ed2c9694bc9f231f8fb6e3d6bb4f8f9c251085145a2c7f5d2d04884bc071a68b64dc4ee
7
+ data.tar.gz: 32f0ce4bd5c4425ab855e4d606b50d117be8609c4cf23ba0968b2ced644fcdc29ca1f5ad7b8b345b6b6bf42a0cee374c973ec8d6ac191ab7c37623c6c729b2be
@@ -17,6 +17,9 @@ before_script:
17
17
  - merge_requests
18
18
 
19
19
  stage: test
20
+ retry:
21
+ max: 2
22
+ when: script_failure
20
23
 
21
24
  # Use only the following CI runners
22
25
  tags:
@@ -27,10 +30,45 @@ rubocop:
27
30
  script:
28
31
  - bundle exec rubocop
29
32
 
30
- rspec-without-features:
33
+ rspec (controllers):
31
34
  extends: .base-test
32
35
  script:
33
- - bundle exec rspec --exclude-pattern "spec/features/**/*_spec.rb"
36
+ - bundle exec rspec spec/controllers
37
+
38
+ rspec (jobs):
39
+ extends: .base-test
40
+ script:
41
+ - bundle exec rspec spec/jobs
42
+
43
+ rspec (lib):
44
+ extends: .base-test
45
+ script:
46
+ - bundle exec rspec spec/lib
47
+
48
+ rspec (models):
49
+ extends: .base-test
50
+ script:
51
+ - bundle exec rspec spec/models
52
+
53
+ rspec (other):
54
+ extends: .base-test
55
+ script:
56
+ - bundle exec rspec spec/other
57
+
58
+ rspec (performance):
59
+ extends: .base-test
60
+ script:
61
+ - bundle exec rspec spec/performance
62
+
63
+ rspec (requests):
64
+ extends: .base-test
65
+ script:
66
+ - bundle exec rspec spec/requests
67
+
68
+ rspec (services):
69
+ extends: .base-test
70
+ script:
71
+ - bundle exec rspec spec/services
34
72
 
35
73
  rspec-features-1:
36
74
  extends: .base-test
@@ -2,7 +2,7 @@ inherit_from: .rubocop_todo.yml
2
2
  require: rubocop-performance
3
3
 
4
4
  AllCops:
5
- TargetRubyVersion: 2.3.3
5
+ TargetRubyVersion: 2.4.2
6
6
  Exclude:
7
7
  - 'db/**/*'
8
8
  - 'spec/dummy/**/*'
@@ -1,20 +1,11 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2019-09-12 08:37:20 -0700 using RuboCop version 0.73.0.
3
+ # on 2019-11-28 17:01:18 -0800 using RuboCop version 0.77.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: 416
10
- # Cop supports --auto-correct.
11
- # Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
12
- # SupportedHashRocketStyles: key, separator, table
13
- # SupportedColonStyles: key, separator, table
14
- # SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
15
- Layout/AlignHash:
16
- Enabled: false
17
-
18
9
  # Offense count: 38
19
10
  # Cop supports --auto-correct.
20
11
  Layout/ClosingHeredocIndentation:
@@ -23,28 +14,26 @@ Layout/ClosingHeredocIndentation:
23
14
  - 'spec/support/components/netzke_combobox.rb'
24
15
  - 'spec/support/components/netzke_grid.rb'
25
16
 
26
- # Offense count: 57
17
+ # Offense count: 56
27
18
  # Cop supports --auto-correct.
28
19
  # Configuration parameters: EnforcedStyleAlignWith, AutoCorrect, Severity.
29
20
  # SupportedStylesAlignWith: keyword, variable, start_of_line
30
21
  Layout/EndAlignment:
31
22
  Enabled: false
32
23
 
33
- # Offense count: 32
24
+ # Offense count: 29
34
25
  # Cop supports --auto-correct.
35
26
  # Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment.
36
27
  Layout/ExtraSpacing:
37
28
  Exclude:
38
29
  - 'app/components/marty/data_grid_view.rb'
39
30
  - 'app/components/marty/posting_window.rb'
40
- - 'lib/marty/logger.rb'
41
31
  - 'lib/marty/migrations.rb'
42
32
  - 'lib/marty/monkey.rb'
43
33
  - 'spec/controllers/rpc_controller_spec.rb'
44
34
  - 'spec/features/rule_spec.rb'
45
35
  - 'spec/lib/json_schema_spec.rb'
46
36
  - 'spec/models/data_grid_spec.rb'
47
- - 'spec/models/event_spec.rb'
48
37
  - 'spec/models/rule_spec.rb'
49
38
  - 'spec/models/script_spec.rb'
50
39
 
@@ -52,7 +41,7 @@ Layout/ExtraSpacing:
52
41
  # Cop supports --auto-correct.
53
42
  # Configuration parameters: EnforcedStyle, IndentationWidth.
54
43
  # SupportedStyles: special_inside_parentheses, consistent, align_braces
55
- Layout/IndentFirstHashElement:
44
+ Layout/FirstHashElementIndentation:
56
45
  Exclude:
57
46
  - 'app/components/marty/extras/layout.rb'
58
47
  - 'spec/controllers/diagnostic/controller_spec.rb'
@@ -61,26 +50,49 @@ Layout/IndentFirstHashElement:
61
50
  - 'spec/lib/json_schema_spec.rb'
62
51
  - 'spec/models/api_auth_spec.rb'
63
52
 
64
- # Offense count: 93
53
+ # Offense count: 394
54
+ # Cop supports --auto-correct.
55
+ # Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
56
+ # SupportedHashRocketStyles: key, separator, table
57
+ # SupportedColonStyles: key, separator, table
58
+ # SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
59
+ Layout/HashAlignment:
60
+ Enabled: false
61
+
62
+ # Offense count: 95
65
63
  # Cop supports --auto-correct.
66
64
  # Configuration parameters: EnforcedStyle.
67
65
  # SupportedStyles: squiggly, active_support, powerpack, unindent
68
- Layout/IndentHeredoc:
69
- Enabled: false
66
+ Layout/HeredocIndentation:
67
+ Exclude:
68
+ - 'app/components/marty/data_grid_user_view.rb'
69
+ - 'lib/marty/migrations.rb'
70
+ - 'spec/controllers/rpc_controller_spec.rb'
71
+ - 'spec/features/reporting_spec.rb'
72
+ - 'spec/features/rule_spec.rb'
73
+ - 'spec/features/scripting_test_spec.rb'
74
+ - 'spec/job_helper.rb'
75
+ - 'spec/lib/data_exporter_spec.rb'
76
+ - 'spec/lib/data_importer_spec.rb'
77
+ - 'spec/lib/delorean_query_spec.rb'
78
+ - 'spec/lib/mcfly_model_spec.rb'
79
+ - 'spec/lib/xl_spec.rb'
80
+ - 'spec/lib/xl_styles_spec.rb'
81
+ - 'spec/models/data_grid_spec.rb'
82
+ - 'spec/models/script_spec.rb'
70
83
 
71
- # Offense count: 290
84
+ # Offense count: 283
72
85
  # Cop supports --auto-correct.
73
86
  # Configuration parameters: Width, IgnoredPatterns.
74
87
  Layout/IndentationWidth:
75
88
  Enabled: false
76
89
 
77
- # Offense count: 20
90
+ # Offense count: 19
78
91
  # Cop supports --auto-correct.
79
92
  # Configuration parameters: EnforcedStyle.
80
93
  # SupportedStyles: symmetrical, new_line, same_line
81
94
  Layout/MultilineHashBraceLayout:
82
95
  Exclude:
83
- - 'app/components/marty/event_view.rb'
84
96
  - 'app/components/marty/user_view.rb'
85
97
  - 'app/models/marty/delorean_rule.rb'
86
98
  - 'lib/marty/migrations.rb'
@@ -89,14 +101,14 @@ Layout/MultilineHashBraceLayout:
89
101
  - 'spec/lib/json_schema_spec.rb'
90
102
  - 'spec/other/diagnostic/base_spec.rb'
91
103
 
92
- # Offense count: 118
104
+ # Offense count: 115
93
105
  # Cop supports --auto-correct.
94
106
  # Configuration parameters: EnforcedStyle.
95
107
  # SupportedStyles: symmetrical, new_line, same_line
96
108
  Layout/MultilineMethodCallBraceLayout:
97
109
  Enabled: false
98
110
 
99
- # Offense count: 92
111
+ # Offense count: 96
100
112
  # Cop supports --auto-correct.
101
113
  # Configuration parameters: EnforcedStyle, IndentationWidth.
102
114
  # SupportedStyles: aligned, indented, indented_relative_to_receiver
@@ -146,18 +158,12 @@ Lint/AmbiguousOperator:
146
158
  - 'app/components/marty/script_form.rb'
147
159
  - 'lib/marty/diagnostic/aws/ec2_instance.rb'
148
160
 
149
- # Offense count: 3
161
+ # Offense count: 2
150
162
  Lint/AmbiguousRegexpLiteral:
151
163
  Exclude:
152
164
  - 'spec/controllers/job_controller_spec.rb'
153
165
  - 'spec/models/posting_spec.rb'
154
166
 
155
- # Offense count: 1
156
- # Configuration parameters: AllowSafeAssignment.
157
- Lint/AssignmentInCondition:
158
- Exclude:
159
- - 'app/components/marty/event_view.rb'
160
-
161
167
  # Offense count: 2
162
168
  Lint/Debugger:
163
169
  Exclude:
@@ -170,13 +176,6 @@ Lint/DuplicateMethods:
170
176
  - 'spec/support/components/netzke_grid.rb'
171
177
  - 'spec/support/shared_connection_db_helpers.rb'
172
178
 
173
- # Offense count: 2
174
- # Configuration parameters: AllowComments.
175
- Lint/HandleExceptions:
176
- Exclude:
177
- - 'spec/support/netzke.rb'
178
- - 'lib/marty/delayed_job/scheduled_job_plugin.rb'
179
-
180
179
  # Offense count: 19
181
180
  Lint/IneffectiveAccessModifier:
182
181
  Exclude:
@@ -204,6 +203,14 @@ Lint/ParenthesesAsGroupedExpression:
204
203
  - 'spec/models/user_spec.rb'
205
204
  - 'spec/support/suite.rb'
206
205
 
206
+ # Offense count: 7
207
+ # Cop supports --auto-correct.
208
+ Lint/RedundantStringCoercion:
209
+ Exclude:
210
+ - 'app/components/marty/api_log_view.rb'
211
+ - 'app/components/marty/import_view.rb'
212
+ - 'spec/support/netzke.rb'
213
+
207
214
  # Offense count: 1
208
215
  Lint/RescueException:
209
216
  Exclude:
@@ -226,12 +233,12 @@ Lint/ShadowingOuterLocalVariable:
226
233
  - 'lib/marty/diagnostic/database.rb'
227
234
  - 'lib/marty/json_schema.rb'
228
235
 
229
- # Offense count: 7
230
- # Cop supports --auto-correct.
231
- Lint/StringConversionInInterpolation:
236
+ # Offense count: 5
237
+ # Configuration parameters: AllowComments.
238
+ Lint/SuppressedException:
232
239
  Exclude:
233
- - 'app/components/marty/api_log_view.rb'
234
- - 'app/components/marty/import_view.rb'
240
+ - 'lib/marty/delayed_job/scheduled_job_plugin.rb'
241
+ - 'spec/features/data_grid_spec.rb'
235
242
  - 'spec/support/netzke.rb'
236
243
 
237
244
  # Offense count: 2
@@ -257,7 +264,7 @@ Lint/UselessAccessModifier:
257
264
  - 'lib/marty/diagnostic/reporter.rb'
258
265
  - 'lib/marty/json_schema.rb'
259
266
 
260
- # Offense count: 90
267
+ # Offense count: 105
261
268
  Lint/UselessAssignment:
262
269
  Enabled: false
263
270
 
@@ -271,35 +278,35 @@ Lint/Void:
271
278
  - 'spec/lib/xl_styles_spec.rb'
272
279
  - 'spec/models/posting_spec.rb'
273
280
 
274
- # Offense count: 107
281
+ # Offense count: 105
275
282
  Metrics/AbcSize:
276
283
  Max: 129
277
284
 
278
- # Offense count: 21
285
+ # Offense count: 22
279
286
  # Configuration parameters: CountComments.
280
287
  Metrics/ClassLength:
281
288
  Max: 452
282
289
 
283
- # Offense count: 65
290
+ # Offense count: 66
284
291
  Metrics/CyclomaticComplexity:
285
292
  Max: 40
286
293
 
287
- # Offense count: 169
294
+ # Offense count: 170
288
295
  # Configuration parameters: CountComments, ExcludedMethods.
289
296
  Metrics/MethodLength:
290
297
  Max: 98
291
298
 
292
- # Offense count: 11
299
+ # Offense count: 12
293
300
  # Configuration parameters: CountComments.
294
301
  Metrics/ModuleLength:
295
302
  Max: 598
296
303
 
297
- # Offense count: 17
304
+ # Offense count: 16
298
305
  # Configuration parameters: CountKeywordArgs.
299
306
  Metrics/ParameterLists:
300
307
  Max: 10
301
308
 
302
- # Offense count: 48
309
+ # Offense count: 50
303
310
  Metrics/PerceivedComplexity:
304
311
  Max: 35
305
312
 
@@ -325,9 +332,9 @@ Naming/HeredocDelimiterCase:
325
332
  - 'spec/controllers/rpc_controller_spec.rb'
326
333
  - 'spec/models/script_spec.rb'
327
334
 
328
- # Offense count: 64
329
- # Configuration parameters: Blacklist.
330
- # Blacklist: (?-mix:(^|\s)(EO[A-Z]{1}|END)(\s|$))
335
+ # Offense count: 67
336
+ # Configuration parameters: ForbiddenDelimiters.
337
+ # ForbiddenDelimiters: (?-mix:(^|\s)(EO[A-Z]{1}|END)(\s|$))
331
338
  Naming/HeredocDelimiterNaming:
332
339
  Exclude:
333
340
  - 'lib/marty/migrations.rb'
@@ -341,11 +348,17 @@ Naming/HeredocDelimiterNaming:
341
348
  - 'spec/lib/xl_styles_spec.rb'
342
349
  - 'spec/models/data_grid_spec.rb'
343
350
 
351
+ # Offense count: 150
352
+ # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
353
+ # AllowedNames: io, id, to, by, on, in, at, ip, db, os
354
+ Naming/MethodParameterName:
355
+ Enabled: false
356
+
344
357
  # Offense count: 10
345
- # Configuration parameters: NamePrefix, NamePrefixBlacklist, NameWhitelist, MethodDefinitionMacros.
358
+ # Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros.
346
359
  # NamePrefix: is_, has_, have_
347
- # NamePrefixBlacklist: is_, has_, have_
348
- # NameWhitelist: is_a?
360
+ # ForbiddenPrefixes: is_, has_, have_
361
+ # AllowedMethods: is_a?
349
362
  # MethodDefinitionMacros: define_method, define_singleton_method
350
363
  Naming/PredicateName:
351
364
  Exclude:
@@ -358,13 +371,7 @@ Naming/PredicateName:
358
371
  - 'lib/marty/diagnostic/packer.rb'
359
372
  - 'lib/marty/permissions.rb'
360
373
 
361
- # Offense count: 145
362
- # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
363
- # AllowedNames: io, id, to, by, on, in, at, ip, db
364
- Naming/UncommunicativeMethodParamName:
365
- Enabled: false
366
-
367
- # Offense count: 3
374
+ # Offense count: 4
368
375
  # Configuration parameters: EnforcedStyle.
369
376
  # SupportedStyles: snake_case, camelCase
370
377
  Naming/VariableName:
@@ -379,12 +386,11 @@ Performance/Casecmp:
379
386
  Exclude:
380
387
  - 'app/components/marty/base_rule_view.rb'
381
388
 
382
- # Offense count: 2
389
+ # Offense count: 1
383
390
  # Cop supports --auto-correct.
384
391
  Performance/CompareWithBlock:
385
392
  Exclude:
386
393
  - 'app/components/marty/report_select.rb'
387
- - 'app/models/marty/event.rb'
388
394
 
389
395
  # Offense count: 1
390
396
  # Cop supports --auto-correct.
@@ -410,15 +416,13 @@ Performance/RedundantBlockCall:
410
416
  - 'spec/features/scripting_test_spec.rb'
411
417
  - 'spec/support/setup.rb'
412
418
 
413
- # Offense count: 4
419
+ # Offense count: 2
414
420
  # Cop supports --auto-correct.
415
421
  Performance/RedundantMatch:
416
422
  Exclude:
417
423
  - 'lib/marty/migrations.rb'
418
- - 'spec/support/components/netzke_combobox.rb'
419
- - 'spec/support/components/netzke_grid.rb'
420
424
 
421
- # Offense count: 5
425
+ # Offense count: 4
422
426
  # Cop supports --auto-correct.
423
427
  # Configuration parameters: MaxKeyValuePairs.
424
428
  Performance/RedundantMerge:
@@ -426,7 +430,6 @@ Performance/RedundantMerge:
426
430
  - 'app/components/marty/api_config_view.rb'
427
431
  - 'app/components/marty/base_rule_view.rb'
428
432
  - 'app/components/marty/data_grid_view.rb'
429
- - 'app/components/marty/event_view.rb'
430
433
  - 'app/components/marty/user_view.rb'
431
434
 
432
435
  # Offense count: 21
@@ -462,14 +465,13 @@ Style/Alias:
462
465
  - 'spec/support/components/netzke_grid.rb'
463
466
  - 'spec/support/shared_connection.rb'
464
467
 
465
- # Offense count: 3
468
+ # Offense count: 2
466
469
  # Cop supports --auto-correct.
467
470
  # Configuration parameters: EnforcedStyle.
468
471
  # SupportedStyles: always, conditionals
469
472
  Style/AndOr:
470
473
  Exclude:
471
474
  - 'app/components/marty/import_view.rb'
472
- - 'app/models/marty/config.rb'
473
475
 
474
476
  # Offense count: 23
475
477
  # Cop supports --auto-correct.
@@ -485,20 +487,6 @@ Style/BarePercentLiterals:
485
487
  - 'spec/models/config_spec.rb'
486
488
  - 'spec/support/netzke.rb'
487
489
 
488
- # Offense count: 1
489
- Style/CaseEquality:
490
- Exclude:
491
- - 'app/components/marty/report_form.rb'
492
- - 'app/models/marty/data_grid.rb'
493
- - 'app/helpers/marty/enum_helper.rb'
494
- - 'lib/marty/data_change.rb'
495
- - 'lib/marty/data_conversion.rb'
496
- - 'lib/marty/mcfly_model.rb'
497
- - 'lib/marty/monkey.rb'
498
- - 'other/marty/api/base.rb'
499
- - 'spec/lib/mcfly_model_spec.rb'
500
- - 'lib/marty/api/base.rb'
501
-
502
490
  # Offense count: 132
503
491
  # Cop supports --auto-correct.
504
492
  # Configuration parameters: AutoCorrect, EnforcedStyle.
@@ -550,29 +538,27 @@ Style/CommentAnnotation:
550
538
  - 'app/models/marty/promise.rb'
551
539
  - 'lib/marty/xl.rb'
552
540
 
553
- # Offense count: 5
541
+ # Offense count: 4
554
542
  # Cop supports --auto-correct.
555
543
  # Configuration parameters: EnforcedStyle, SingleLineConditionsOnly, IncludeTernaryExpressions.
556
544
  # SupportedStyles: assign_to_condition, assign_inside_condition
557
545
  Style/ConditionalAssignment:
558
546
  Exclude:
559
- - 'app/components/marty/auth_app.rb'
560
547
  - 'app/controllers/marty/application_controller.rb'
561
548
  - 'spec/other/diagnostic/reporter_spec.rb'
562
549
  - 'spec/support/components/netzke_combobox.rb'
563
550
  - 'spec/support/components/netzke_grid.rb'
564
551
 
565
- # Offense count: 164
552
+ # Offense count: 189
566
553
  Style/Documentation:
567
554
  Enabled: false
568
555
 
569
- # Offense count: 5
556
+ # Offense count: 4
570
557
  Style/DoubleNegation:
571
558
  Exclude:
572
559
  - 'app/components/marty/auth_app.rb'
573
560
  - 'app/components/marty/report_form.rb'
574
561
  - 'app/models/marty/data_grid.rb'
575
- - 'app/models/marty/event.rb'
576
562
 
577
563
  # Offense count: 1
578
564
  # Cop supports --auto-correct.
@@ -623,7 +609,7 @@ Style/FormatString:
623
609
  - 'spec/models/rule_spec.rb'
624
610
  - 'spec/support/performance_helper.rb'
625
611
 
626
- # Offense count: 9
612
+ # Offense count: 12
627
613
  # Configuration parameters: EnforcedStyle.
628
614
  # SupportedStyles: annotated, template, unannotated
629
615
  Style/FormatStringToken:
@@ -635,7 +621,7 @@ Style/FormatStringToken:
635
621
  - 'spec/models/rule_spec.rb'
636
622
  - 'spec/support/performance_helper.rb'
637
623
 
638
- # Offense count: 215
624
+ # Offense count: 248
639
625
  # Cop supports --auto-correct.
640
626
  # Configuration parameters: EnforcedStyle.
641
627
  # SupportedStyles: always, never
@@ -697,7 +683,7 @@ Style/InverseMethods:
697
683
  - 'lib/marty/xl.rb'
698
684
  - 'spec/support/download_helper.rb'
699
685
 
700
- # Offense count: 30
686
+ # Offense count: 27
701
687
  # Cop supports --auto-correct.
702
688
  # Configuration parameters: EnforcedStyle.
703
689
  # SupportedStyles: line_count_dependent, lambda, literal
@@ -707,7 +693,6 @@ Style/Lambda:
707
693
  - 'app/components/marty/api_log_view.rb'
708
694
  - 'app/components/marty/base_rule_view.rb'
709
695
  - 'app/components/marty/config_view.rb'
710
- - 'app/components/marty/event_view.rb'
711
696
  - 'app/components/marty/extras/layout.rb'
712
697
  - 'app/components/marty/log_view.rb'
713
698
  - 'app/components/marty/promise_view.rb'
@@ -743,7 +728,7 @@ Style/MethodCallWithoutArgsParentheses:
743
728
  - 'spec/lib/xl_spec.rb'
744
729
  - 'spec/lib/xl_styles_spec.rb'
745
730
 
746
- # Offense count: 100
731
+ # Offense count: 103
747
732
  # Cop supports --auto-correct.
748
733
  # Configuration parameters: EnforcedStyle.
749
734
  # SupportedStyles: require_parentheses, require_no_parentheses, require_no_parentheses_except_multiline
@@ -755,10 +740,9 @@ Style/MethodMissingSuper:
755
740
  Exclude:
756
741
  - 'lib/marty/promise_proxy.rb'
757
742
 
758
- # Offense count: 2
743
+ # Offense count: 1
759
744
  Style/MissingRespondToMissing:
760
745
  Exclude:
761
- - 'lib/marty/logger.rb'
762
746
  - 'lib/marty/promise_proxy.rb'
763
747
 
764
748
  # Offense count: 1
@@ -769,11 +753,10 @@ Style/ModuleFunction:
769
753
  Exclude:
770
754
  - 'spec/support/download_helper.rb'
771
755
 
772
- # Offense count: 8
756
+ # Offense count: 5
773
757
  Style/MultilineBlockChain:
774
758
  Exclude:
775
759
  - 'app/components/marty/report_select.rb'
776
- - 'app/models/marty/event.rb'
777
760
  - 'lib/marty/diagnostic/delayed_job_version.rb'
778
761
  - 'lib/marty/diagnostic/node.rb'
779
762
  - 'lib/marty/migrations.rb'
@@ -796,7 +779,7 @@ Style/MultilineIfModifier:
796
779
  - 'lib/marty/xl.rb'
797
780
  - 'spec/support/structure_compare.rb'
798
781
 
799
- # Offense count: 39
782
+ # Offense count: 40
800
783
  Style/MultilineTernaryOperator:
801
784
  Enabled: false
802
785
 
@@ -806,7 +789,7 @@ Style/MultipleComparison:
806
789
  - 'app/components/marty/base_rule_view.rb'
807
790
  - 'lib/marty/xl.rb'
808
791
 
809
- # Offense count: 74
792
+ # Offense count: 79
810
793
  # Cop supports --auto-correct.
811
794
  # Configuration parameters: EnforcedStyle.
812
795
  # SupportedStyles: literals, strict
@@ -839,8 +822,8 @@ Style/NegatedWhile:
839
822
 
840
823
  # Offense count: 1
841
824
  # Cop supports --auto-correct.
842
- # Configuration parameters: Whitelist.
843
- # Whitelist: be, be_a, be_an, be_between, be_falsey, be_kind_of, be_instance_of, be_truthy, be_within, eq, eql, end_with, include, match, raise_error, respond_to, start_with
825
+ # Configuration parameters: AllowedMethods.
826
+ # AllowedMethods: be, be_a, be_an, be_between, be_falsey, be_kind_of, be_instance_of, be_truthy, be_within, eq, eql, end_with, include, match, raise_error, respond_to, start_with
844
827
  Style/NestedParenthesizedCalls:
845
828
  Exclude:
846
829
  - 'spec/controllers/job_controller_spec.rb'
@@ -861,26 +844,25 @@ Style/Next:
861
844
  Exclude:
862
845
  - 'lib/marty/xl.rb'
863
846
 
864
- # Offense count: 11
847
+ # Offense count: 9
865
848
  # Cop supports --auto-correct.
866
849
  # Configuration parameters: Strict.
867
850
  Style/NumericLiterals:
868
851
  MinDigits: 7
869
852
 
870
- # Offense count: 18
853
+ # Offense count: 16
871
854
  # Cop supports --auto-correct.
872
855
  # Configuration parameters: AutoCorrect, EnforcedStyle, IgnoredMethods.
873
856
  # SupportedStyles: predicate, comparison
874
857
  Style/NumericPredicate:
875
858
  Exclude:
876
859
  - 'spec/**/*'
877
- - 'app/models/marty/event.rb'
878
860
  - 'lib/marty/content_handler.rb'
879
861
  - 'lib/marty/data_change.rb'
880
862
  - 'lib/marty/data_importer.rb'
881
863
  - 'lib/marty/xl.rb'
882
864
 
883
- # Offense count: 36
865
+ # Offense count: 39
884
866
  # Cop supports --auto-correct.
885
867
  Style/ParallelAssignment:
886
868
  Enabled: false
@@ -894,7 +876,7 @@ Style/ParenthesesAroundCondition:
894
876
  - 'lib/marty/data_change.rb'
895
877
  - 'lib/marty/xl.rb'
896
878
 
897
- # Offense count: 11
879
+ # Offense count: 7
898
880
  # Cop supports --auto-correct.
899
881
  # Configuration parameters: PreferredDelimiters.
900
882
  Style/PercentLiteralDelimiters:
@@ -902,7 +884,6 @@ Style/PercentLiteralDelimiters:
902
884
  - 'app/components/marty/simple_app.rb'
903
885
  - 'app/models/marty/data_grid.rb'
904
886
  - 'lib/marty/migrations.rb'
905
- - 'spec/models/event_spec.rb'
906
887
  - 'spec/models/rule_spec.rb'
907
888
 
908
889
  # Offense count: 12
@@ -921,7 +902,15 @@ Style/PerlBackrefs:
921
902
  Exclude:
922
903
  - 'lib/marty/migrations.rb'
923
904
 
924
- # Offense count: 6
905
+ # Offense count: 12
906
+ # Cop supports --auto-correct.
907
+ Style/RedundantPercentQ:
908
+ Exclude:
909
+ - 'app/components/marty/simple_app.rb'
910
+ - 'spec/features/rule_spec.rb'
911
+ - 'spec/models/config_spec.rb'
912
+
913
+ # Offense count: 5
925
914
  # Cop supports --auto-correct.
926
915
  # Configuration parameters: EnforcedStyle, AllowInnerSlashes.
927
916
  # SupportedStyles: slashes, percent_r, mixed
@@ -932,30 +921,27 @@ Style/RegexpLiteral:
932
921
  - 'lib/marty/migrations.rb'
933
922
  - 'lib/marty/monkey.rb'
934
923
  - 'lib/marty/xl.rb'
935
- - 'spec/models/event_spec.rb'
936
924
 
937
- # Offense count: 36
925
+ # Offense count: 35
938
926
  # Cop supports --auto-correct.
939
927
  Style/RescueModifier:
940
928
  Enabled: false
941
929
 
942
- # Offense count: 20
930
+ # Offense count: 18
943
931
  # Cop supports --auto-correct.
944
- # Configuration parameters: ConvertCodeThatCanStartToReturnNil, Whitelist.
945
- # Whitelist: present?, blank?, presence, try, try!
932
+ # Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods.
933
+ # AllowedMethods: present?, blank?, presence, try, try!
946
934
  Style/SafeNavigation:
947
935
  Exclude:
948
936
  - 'app/components/marty/extras/layout.rb'
949
937
  - 'app/components/marty/script_grid.rb'
950
938
  - 'app/controllers/marty/application_controller.rb'
951
939
  - 'app/controllers/marty/diagnostic/controller.rb'
952
- - 'app/models/marty/config.rb'
953
940
  - 'app/models/marty/data_grid.rb'
954
941
  - 'app/models/marty/delorean_rule.rb'
955
942
  - 'app/models/marty/enum.rb'
956
943
  - 'app/models/marty/import_type.rb'
957
944
  - 'app/models/marty/tag.rb'
958
- - 'lib/marty/cache_adapters/mcfly_ruby_cache.rb'
959
945
  - 'lib/marty/data_importer.rb'
960
946
  - 'lib/marty/mcfly_model.rb'
961
947
  - 'lib/marty/xl.rb'
@@ -1001,7 +987,7 @@ Style/TernaryParentheses:
1001
987
  - 'app/models/marty/data_grid.rb'
1002
988
  - 'lib/marty/xl.rb'
1003
989
 
1004
- # Offense count: 40
990
+ # Offense count: 39
1005
991
  # Cop supports --auto-correct.
1006
992
  Style/TrailingBodyOnModule:
1007
993
  Enabled: false
@@ -1013,42 +999,28 @@ Style/TrailingBodyOnModule:
1013
999
  Style/TrailingCommaInArguments:
1014
1000
  Enabled: false
1015
1001
 
1016
- # Offense count: 53
1002
+ # Offense count: 55
1017
1003
  # Cop supports --auto-correct.
1018
1004
  # Configuration parameters: EnforcedStyleForMultiline.
1019
1005
  # SupportedStylesForMultiline: comma, consistent_comma, no_comma
1020
1006
  Style/TrailingCommaInArrayLiteral:
1021
1007
  Enabled: false
1022
1008
 
1023
- # Offense count: 146
1009
+ # Offense count: 148
1024
1010
  # Cop supports --auto-correct.
1025
1011
  # Configuration parameters: EnforcedStyleForMultiline.
1026
1012
  # SupportedStylesForMultiline: comma, consistent_comma, no_comma
1027
1013
  Style/TrailingCommaInHashLiteral:
1028
1014
  Enabled: false
1029
1015
 
1030
- # Offense count: 12
1031
- # Cop supports --auto-correct.
1032
- Style/RedundantPercentQ:
1033
- Exclude:
1034
- - 'app/components/marty/simple_app.rb'
1035
- - 'spec/features/rule_spec.rb'
1036
- - 'spec/models/config_spec.rb'
1037
-
1038
- # Offense count: 1
1039
- # Cop supports --auto-correct.
1040
- Style/RedundantSort:
1041
- Exclude:
1042
- - 'app/models/marty/event.rb'
1043
-
1044
- # Offense count: 97
1016
+ # Offense count: 94
1045
1017
  # Cop supports --auto-correct.
1046
1018
  # Configuration parameters: EnforcedStyle, MinSize, WordRegex.
1047
1019
  # SupportedStyles: percent, brackets
1048
1020
  Style/WordArray:
1049
1021
  Enabled: false
1050
1022
 
1051
- # Offense count: 137
1023
+ # Offense count: 149
1052
1024
  # Cop supports --auto-correct.
1053
1025
  # Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
1054
1026
  # URISchemes: http, https
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source 'http://rubygems.org'
1
+ source 'https://rubygems.org'
2
2
 
3
3
  # Declare your gem's dependencies in marty.gemspec.
4
4
  # Bundler will treat runtime dependencies like base dependencies, and
@@ -75,7 +75,7 @@ module Layout
75
75
 
76
76
  def enum_column(c, class_or_array, col = nil, allow_null = true)
77
77
  col ||= c.name.demodulize.tableize.singularize
78
- vals = class_or_array.is_a?(Array) ? class_or_array : class_or_array::VALUES
78
+ vals = class_or_array.is_a?(Array) ? class_or_array : class_or_array.values
79
79
  editor_config = {
80
80
  trigger_action: :all,
81
81
  xtype: :combo,
@@ -99,7 +99,7 @@ module Layout
99
99
  def enum_array(c, klass)
100
100
  editor_config = {
101
101
  multi_select: true,
102
- store: klass::VALUES.to_a.sort,
102
+ store: klass.values.to_a.sort,
103
103
  type: :string,
104
104
  xtype: :combo,
105
105
  }
@@ -153,7 +153,7 @@ module Marty; class UserView < Marty::Grid
153
153
  Marty::RoleType.to_nice_names(r.user_roles.map(&:role))
154
154
  end
155
155
 
156
- store = ::Marty::RoleType.to_nice_names(::Marty::RoleType::VALUES.sort)
156
+ store = ::Marty::RoleType.to_nice_names(::Marty::RoleType.values.sort)
157
157
 
158
158
  c.editor_config = {
159
159
  multi_select: true,
@@ -156,7 +156,7 @@ module Marty
156
156
  Marty::RoleType.to_nice_names(r.user_roles.map(&:role))
157
157
  end
158
158
 
159
- store = ::Marty::RoleType.to_nice_names(::Marty::RoleType::VALUES.sort)
159
+ store = ::Marty::RoleType.to_nice_names(::Marty::RoleType.values.sort)
160
160
 
161
161
  c.editor_config = {
162
162
  multi_select: true,
@@ -83,7 +83,9 @@ class Marty::RpcController < ActionController::Base
83
83
  ret_arr = true
84
84
  end
85
85
 
86
- return { error: 'Malformed attrs' } unless attr =~ /\A[a-z][a-zA-Z0-9_]*\z/
86
+ return { error: 'Malformed attrs' } unless /\A[a-z][a-zA-Z0-9_]*\z/.match?(
87
+ attr.to_s
88
+ )
87
89
 
88
90
  begin
89
91
  case params
@@ -42,9 +42,10 @@ class Marty::BaseRule < Marty::Base
42
42
  return errors[errtype] << "- Wrong type for #{ns}" unless
43
43
  gettypes(vv).member?(type)
44
44
  end
45
+
45
46
  return unless enum || values
46
47
 
47
- vals = enum && enum::VALUES || values.to_set
48
+ vals = enum&.values || values.to_set
48
49
  bad = (vs - vals)
49
50
  p = bad.count > 1 ? 's' : ''
50
51
  return errors[errtype] <<
@@ -48,7 +48,7 @@ class Marty::DataGrid < Marty::Base
48
48
 
49
49
  # enforce Delorean attr syntax (a bit Draconian)
50
50
  dg.errors.add(:base, "bad attribute '#{attr}'") unless
51
- attr =~ /^[a-z][A-Za-z0-9_]*$/
51
+ /^[a-z][A-Za-z0-9_]*$/.match?(attr)
52
52
 
53
53
  dg.errors.add(:base, "unknown metadata type #{type}") unless
54
54
  Marty::DataGrid.type_to_index(type)
@@ -13,7 +13,7 @@ class Marty::DeloreanRule < Marty::BaseRule
13
13
  eclass = engine && engine.constantize || Marty::RuleScriptSet
14
14
  eng = eclass.new('infinity').get_engine(self_as_hash)
15
15
  rescue StandardError => e
16
- return errors[:computed] << '- ' + e.message
16
+ errors[:computed] << '- ' + e.message
17
17
  end
18
18
  end
19
19
  end
@@ -8,7 +8,7 @@ class Marty::NameValidator < ActiveModel::Validator
8
8
  return if value.nil?
9
9
 
10
10
  # disallow leading, trailing, >1 internal spaces, special chars (|)
11
- if value =~ /\A\s|\s\z|\A.*\s\s.*\z|.*\|.*/
11
+ if /\A\s|\s\z|\A.*\s\s.*\z|.*\|.*/.match?(value)
12
12
  entry.errors[field] <<
13
13
  I18n.t('activerecord.errors.messages.extraneous_spaces')
14
14
  end
@@ -4,7 +4,7 @@ module Marty::PgEnum
4
4
  index = (i1 || i0).to_s
5
5
 
6
6
  raise "no such #{name}: '#{index}'" unless
7
- self::VALUES.include?(index)
7
+ values.include?(index)
8
8
 
9
9
  index
10
10
  end
@@ -14,7 +14,7 @@ module Marty::PgEnum
14
14
  extend ::Delorean::Functions unless respond_to?(:delorean_fn)
15
15
 
16
16
  delorean_fn :get_all do |_pt = nil|
17
- self::VALUES.map(&:to_s)
17
+ values.map(&:to_s)
18
18
  end
19
19
 
20
20
  delorean_fn :[] do |i0, i1 = nil|
@@ -31,6 +31,10 @@ module Marty::PgEnum
31
31
  end
32
32
  end
33
33
 
34
+ def values
35
+ self::VALUES
36
+ end
37
+
34
38
  def seed
35
39
  end
36
40
 
@@ -5,7 +5,7 @@ module Marty
5
5
  return [] unless constraint
6
6
 
7
7
  dt = DataGrid.convert_data_type(data_type)
8
- if constraint =~ /[><]/
8
+ if /[><]/.match?(constraint)
9
9
  raise "range constraint not allowed for type #{dt}" unless
10
10
  ['integer', 'float'].include?(dt)
11
11
 
@@ -1,6 +1,6 @@
1
1
  class CreateMartyEventOperationEnum < ActiveRecord::Migration[4.2]
2
2
  def change
3
- values = Marty::EnumEventOperation::VALUES
3
+ values = Marty::EnumEventOperation.values
4
4
  str_values = values.map {|v| ActiveRecord::Base.connection.quote v}.join ','
5
5
  execute <<-SQL
6
6
  CREATE TYPE enum_event_operations AS ENUM (#{str_values})
@@ -1,6 +1,6 @@
1
1
  class AddPromiseTypeEnum < ActiveRecord::Migration[4.2]
2
2
  def up
3
- values = Marty::EnumPromiseType::VALUES
3
+ values = Marty::EnumPromiseType.values
4
4
  str_values = values.map {|v| ActiveRecord::Base.connection.quote v}.join ','
5
5
  execute <<-SQL
6
6
  CREATE TYPE marty_promise_types AS ENUM (#{str_values})
@@ -38,7 +38,7 @@ class MigrateMartyRolesToEnum < ActiveRecord::Migration[5.1]
38
38
  add_column :marty_user_roles, :role_id, :integer
39
39
  add_column :marty_import_types, :role_id, :integer
40
40
 
41
- Marty::RoleType::VALUES.each do |role|
41
+ Marty::RoleType.values.each do |role|
42
42
  Marty::Role.create!(name: role)
43
43
  end
44
44
 
@@ -1,6 +1,6 @@
1
1
  class CreateMartyNotificationsEventTypes < ActiveRecord::Migration[4.2]
2
2
  def up
3
- values = ::Marty::Notifications::EventType::VALUES
3
+ values = ::Marty::Notifications::EventType.values
4
4
  str_values = values.map {|v| ActiveRecord::Base.connection.quote v}.join ','
5
5
 
6
6
  execute <<-SQL
@@ -157,11 +157,11 @@ class Marty::Api::Base
157
157
  end
158
158
 
159
159
  # if attr is an array, return result as an array
160
- return retval = params[:return_array] ? [res] : res
160
+ retval = params[:return_array] ? [res] : res
161
161
  rescue StandardError => e
162
162
  msg = Delorean::Engine.grok_runtime_exception(e).symbolize_keys
163
163
  Marty::Logger.info "Evaluation error: #{msg}"
164
- return retval = msg
164
+ retval = msg
165
165
  ensure
166
166
  error = retval.is_a?(Hash) ? retval[:error] : nil
167
167
  end
@@ -56,7 +56,7 @@ class Marty::DataConversion
56
56
  # Dates are kept as float in Google spreadsheets. Need to
57
57
  # convert them to dates.
58
58
  begin
59
- v =~ FLOAT_PAT ? EXCEL_START_DATE + v.to_f :
59
+ FLOAT_PAT.match?(v) ? EXCEL_START_DATE + v.to_f :
60
60
  Mcfly.is_infinity(v) ? 'infinity' : v.to_date
61
61
  rescue StandardError => e
62
62
  raise "date conversion failed for #{v.inspect}}"
@@ -10,7 +10,7 @@ module Marty
10
10
  begin
11
11
  cs = curr_schema.schema['pg_enum']
12
12
  enum = cs.constantize
13
- values = enum::VALUES
13
+ values = enum.values
14
14
  rescue StandardError => e
15
15
  msg = "The property '#{path}': '#{cs}' is not a pg_enum class"
16
16
  validation_error(pro, msg, frag, curr_schema, self, opt[:record_errors])
@@ -10,7 +10,7 @@ module Marty::Migrations
10
10
  raise 'model class needs VALUES (as Set)' unless
11
11
  klass.const_defined?(:VALUES)
12
12
 
13
- values = klass::VALUES
13
+ values = klass.values
14
14
  str_values =
15
15
  values.map { |v| ActiveRecord::Base.connection.quote v }.join ','
16
16
 
@@ -41,7 +41,7 @@ module Marty::Migrations
41
41
  SQL
42
42
 
43
43
  db_values = res.first['enum_range'].gsub(/[{"}]/, '').split(',')
44
- ex_values = klass::VALUES.map(&:to_s) - db_values
44
+ ex_values = klass.values.map(&:to_s) - db_values
45
45
 
46
46
  return if ex_values.empty?
47
47
 
@@ -14,7 +14,7 @@ class Marty::PromiseProxy < BasicObject
14
14
  :as_json,
15
15
  ]
16
16
 
17
- instance_methods.each { |m| undef_method m unless m =~ /^(__.*|object_id)$/ }
17
+ instance_methods.each { |m| undef_method m unless /^(__.*|object_id)$/.match?(m) }
18
18
 
19
19
  def initialize(promise_id, timeout, attr = nil)
20
20
  promise_id, @timeout, @attr = promise_id, timeout, attr
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Marty
4
- VERSION = '8.2.0'
4
+ VERSION = '8.3.1'
5
5
  end
@@ -1022,9 +1022,18 @@ describe Marty::RpcController do
1022
1022
 
1023
1023
  class FruitsEnum
1024
1024
  VALUES = Set['Apple', 'Banana', 'Orange']
1025
+
1026
+ def self.values
1027
+ VALUES
1028
+ end
1025
1029
  end
1030
+
1026
1031
  class CondEnum
1027
1032
  VALUES = Set['no opts', 'opt1', 'opt2', 'opttf']
1033
+
1034
+ def self.values
1035
+ VALUES
1036
+ end
1028
1037
  end
1029
1038
 
1030
1039
  it 'validates schema with a pg_enum (Positive)' do
@@ -2,7 +2,7 @@ class AddRuleTypeEnums < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  [Gemini::XyzRuleType, Gemini::MyRuleType, Gemini::GuardOne,
4
4
  Gemini::GuardTwo, Gemini::XyzEnum].each do |cl|
5
- values = cl::VALUES
5
+ values = cl.values
6
6
  str_values = values.map {|v| ActiveRecord::Base.connection.quote v}.
7
7
  join(',')
8
8
  clstr = cl.to_s.sub('Gemini::','').underscore
@@ -525,7 +525,7 @@ feature 'data grid view', js: true, speed: :super_slow do
525
525
  begin
526
526
  press('Edit Grid')
527
527
  press('Edit Grid')
528
- rescue StandardError => e # rubocop:disable Lint/HandleExceptions
528
+ rescue StandardError => e
529
529
  end
530
530
  wait_for_ajax
531
531
  grid_setup
@@ -544,7 +544,7 @@ feature 'data grid view', js: true, speed: :super_slow do
544
544
  begin
545
545
  press('Edit Grid')
546
546
  press('Edit Grid')
547
- rescue StandardError => e # rubocop:disable Lint/HandleExceptions
547
+ rescue StandardError => e
548
548
  end
549
549
  wait_for_ajax
550
550
  grid_setup
@@ -176,5 +176,20 @@
176
176
  "v1": {"a": 1},
177
177
  "v2": {"a": {"b": 1}},
178
178
  "res": "path=[\"a\"] class mismatch Integer (1) != Hash"
179
+ },
180
+ { "example_number": "33",
181
+ "v1": "[,64)",
182
+ "v2": "[70, 75]",
183
+ "res": "path= [,64) != [70, 75]"
184
+ },
185
+ { "example_number": "34",
186
+ "v1": ["(65,70]"],
187
+ "v2": ["[70, 75)"],
188
+ "res": "path=[0] (65,70] != [70, 75)"
189
+ },
190
+ { "example_number": "35",
191
+ "v1": "(65,70]",
192
+ "v2": "(65,70]",
193
+ "res": false
179
194
  }
180
195
  ]
@@ -2,10 +2,18 @@ require 'spec_helper'
2
2
 
3
3
  class MammalEnum
4
4
  VALUES = Set['Dog', 'Cat', 'Human', 'Cow', 'Bear']
5
+
6
+ def self.values
7
+ VALUES
8
+ end
5
9
  end
6
10
 
7
11
  class ElectronicsEnum
8
12
  VALUES = Set['Phone', 'Keyboard', 'Terminator']
13
+
14
+ def self.values
15
+ VALUES
16
+ end
9
17
  end
10
18
 
11
19
  class NotAnEnum
@@ -933,7 +933,7 @@ EOS
933
933
  # rubocop:enable Style/NestedTernaryOperator
934
934
  con_part = constraint.present? ? "\t" + constraint : ''
935
935
  top = [lenient_str, type_str].compact.join(' ') + con_part + "\n"
936
- (top =~ /\A\s*\z/ ? '' : top) +
936
+ (/\A\s*\z/.match?(top) ? '' : top) +
937
937
  <<~EOS
938
938
  b\tboolean\tv
939
939
  i\tinteger\tv
@@ -12,7 +12,7 @@ module Marty; module RSpec; module Components
12
12
 
13
13
  def initialize(name)
14
14
  @name = name
15
- if /^\d+$/.match(name)
15
+ if /^\d+$/.match?(name)
16
16
  @combobox = ext_find('combobox', nil, name)
17
17
  else
18
18
  @combobox = ext_combo(name)
@@ -13,7 +13,7 @@ module Marty; module RSpec; module Components
13
13
  def initialize(name, c_type)
14
14
  # for now, also allows treepanel
15
15
  @name = name
16
- if /^\d+$/.match(name)
16
+ if /^\d+$/.match?(name)
17
17
  @grid = ext_find(c_type, nil, name)
18
18
  else
19
19
  @grid = ext_find(ext_arg(c_type, name: name))
@@ -27,13 +27,23 @@ module Marty::RSpec::StructureCompare
27
27
  [v1, v2].map(&:class).to_set == Set.new([Integer, Float]))
28
28
 
29
29
  override = (cmp_opts['ignore'] || []).include?(key)
30
+
30
31
  case v1
31
32
  when String
32
- return errs + ["path=#{pathstr} #{v1} != #{v2}"] unless
33
- v1 == v2 ||
34
- Regexp.new('\A' + v1 + '\z').match(v2) ||
35
- Regexp.new('\A' + v2 + '\z').match(v1) ||
36
- override
33
+ return errs if override
34
+ return errs if v1 == v2
35
+
36
+ begin
37
+ return errs if
38
+ Regexp.new('\A' + v1 + '\z').match(v2) ||
39
+ Regexp.new('\A' + v2 + '\z').match(v1)
40
+
41
+ # Invalid regexp, for example: '[, 65)'
42
+ rescue RegexpError
43
+ return errs + ["path=#{pathstr} #{v1} != #{v2}"]
44
+ end
45
+
46
+ return errs + ["path=#{pathstr} #{v1} != #{v2}"]
37
47
  when Integer, DateTime, TrueClass, FalseClass, NilClass, Time, Date
38
48
  return errs + ["path=#{pathstr} #{v1} != #{v2}"] if v1 != v2 && !override
39
49
  when Float
@@ -72,15 +82,23 @@ module Marty::RSpec::StructureCompare
72
82
  end
73
83
 
74
84
  def struct_compare(v1raw, v2raw, cmp_opts = {})
75
- res = Marty::RSpec::StructureCompare.struct_compare_all(v1raw, v2raw, nil,
76
- cmp_opts).first
85
+ res = Marty::RSpec::StructureCompare.struct_compare_all(
86
+ v1raw,
87
+ v2raw,
88
+ nil,
89
+ cmp_opts
90
+ ).first
77
91
  rescue StandardError => e
78
92
  e.message
79
93
  end
80
94
 
81
95
  def struct_compare_all(v1raw, v2raw, cmp_opts = {})
82
- Marty::RSpec::StructureCompare.struct_compare_all(v1raw, v2raw, nil,
83
- cmp_opts)
96
+ Marty::RSpec::StructureCompare.struct_compare_all(
97
+ v1raw,
98
+ v2raw,
99
+ nil,
100
+ cmp_opts
101
+ )
84
102
  rescue StandardError => e
85
103
  e.message
86
104
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: marty
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.2.0
4
+ version: 8.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arman Bostani
@@ -14,7 +14,7 @@ authors:
14
14
  autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
- date: 2019-11-26 00:00:00.000000000 Z
17
+ date: 2019-12-03 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: actioncable