marty 2.7.1 → 2.7.2

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 (43) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +7 -0
  3. data/.rubocop_todo.yml +0 -81
  4. data/Gemfile.lock +1 -1
  5. data/app/components/marty/base_rule_view.rb +5 -6
  6. data/app/components/marty/main_auth_app.rb +2 -2
  7. data/app/components/marty/promise_view.rb +1 -1
  8. data/app/components/marty/simple_app.rb +15 -15
  9. data/app/models/marty/base_rule.rb +1 -1
  10. data/app/models/marty/data_grid.rb +19 -8
  11. data/app/models/marty/delorean_rule.rb +2 -2
  12. data/app/models/marty/pg_enum.rb +1 -1
  13. data/app/models/marty/posting.rb +1 -1
  14. data/app/models/marty/user.rb +1 -1
  15. data/app/models/marty/vw_promise.rb +1 -1
  16. data/lib/marty/data_change.rb +3 -3
  17. data/lib/marty/data_conversion.rb +1 -1
  18. data/lib/marty/data_importer.rb +1 -1
  19. data/lib/marty/engine.rb +1 -1
  20. data/lib/marty/json_schema.rb +1 -1
  21. data/lib/marty/mcfly_model.rb +3 -3
  22. data/lib/marty/migrations.rb +4 -4
  23. data/lib/marty/monkey.rb +1 -1
  24. data/lib/marty/promise_proxy.rb +1 -1
  25. data/lib/marty/rule_script_set.rb +2 -2
  26. data/lib/marty/util.rb +1 -2
  27. data/lib/marty/version.rb +1 -1
  28. data/lib/marty/xl.rb +1 -2
  29. data/other/marty/api/base.rb +2 -2
  30. data/other/marty/diagnostic/nodes.rb +1 -1
  31. data/spec/controllers/diagnostic/controller_spec.rb +1 -1
  32. data/spec/features/reporting_spec.rb +1 -1
  33. data/spec/features/scripting_spec.rb +2 -2
  34. data/spec/features/scripting_test_spec.rb +2 -2
  35. data/spec/features/user_view_spec.rb +5 -5
  36. data/spec/lib/json_schema_spec.rb +5 -5
  37. data/spec/lib/xl_spec.rb +1 -1
  38. data/spec/spec_helper.rb +1 -1
  39. data/spec/support/components/netzke_grid.rb +2 -2
  40. data/spec/support/netzke.rb +4 -4
  41. data/spec/support/shared_connection.rb +2 -2
  42. data/spec/support/users.rb +1 -1
  43. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1dd02192b3d004677a70a48f2f83599ad2d211715002d24a4b48d62e9bef7281
4
- data.tar.gz: e16b0db7764849a5adcba362609f8a8569de0dacd0f606764b5ad2e2ce04c4d3
3
+ metadata.gz: 803d233d1eca573e9cf368dc8592895e9a4f237117842472e59d35dff646f8d5
4
+ data.tar.gz: 31aa8139cf13387596b37e4e934a59837b9e6dff7ca8eff801ff2b5bdc0dfde2
5
5
  SHA512:
6
- metadata.gz: 5684b1cb2f2d3aa73c0360c2b9fe535956e62705c2d652f31dc4f44fc27dbcd67ca5824db025438410ee32094de6f4bd2dc3c2023d51ded3063c0cf498886120
7
- data.tar.gz: 69ec8e2b57199e0198848ffd9563ba40a1489e76e1335e9414334be10ec28ef05f497381e684ec7841035911a2c4460c6b48065633ad85be7221429e557da4e1
6
+ metadata.gz: 82fa093b9db78af2ebe9b47a27673a023b4eafdeb46d2eb5f835113dc142ce12e16486a51098b1cbadf5e93022c28d636457ac01ccbce619fc362ee94832a568
7
+ data.tar.gz: 0db7610f06f94b2e6c48fcdee37b5c024361a8501659d01983892471677738f1c937c47c65c3eb529aa3399c1dc265072e6b9cc279544782dab58e9cf35a7e9e
data/.rubocop.yml CHANGED
@@ -33,3 +33,10 @@ Style/CaseEquality:
33
33
  - 'lib/marty/monkey.rb'
34
34
  - 'other/marty/api/base.rb'
35
35
  - 'spec/lib/mcfly_model_spec.rb'
36
+
37
+ Lint/UnusedMethodArgument:
38
+ AllowUnusedKeywordArguments: true
39
+ IgnoreEmptyMethods: true
40
+
41
+ Style/SymbolArray:
42
+ EnforcedStyle: brackets
data/.rubocop_todo.yml CHANGED
@@ -272,33 +272,6 @@ Lint/UnderscorePrefixedVariableName:
272
272
  - 'lib/marty/monkey.rb'
273
273
  - 'lib/marty/promise_job.rb'
274
274
 
275
- # Offense count: 36
276
- # Cop supports --auto-correct.
277
- # Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments.
278
- Lint/UnusedBlockArgument:
279
- Enabled: false
280
-
281
- # Offense count: 21
282
- # Cop supports --auto-correct.
283
- # Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods.
284
- Lint/UnusedMethodArgument:
285
- Exclude:
286
- - 'app/models/marty/base_rule.rb'
287
- - 'app/models/marty/pg_enum.rb'
288
- - 'app/models/marty/posting.rb'
289
- - 'db/migrate/091_create_marty_promises.rb'
290
- - 'db/migrate/201_create_marty_events.rb'
291
- - 'lib/marty/cache_adapters/mcfly_ruby_cache.rb'
292
- - 'lib/marty/json_schema.rb'
293
- - 'lib/marty/monkey.rb'
294
- - 'lib/marty/promise_proxy.rb'
295
- - 'lib/marty/rule_script_set.rb'
296
- - 'other/marty/api/base.rb'
297
- - 'spec/lib/json_schema_spec.rb'
298
- - 'spec/lib/xl_spec.rb'
299
- - 'spec/support/components/netzke_grid.rb'
300
- - 'spec/support/netzke.rb'
301
-
302
275
  # Offense count: 4
303
276
  Lint/UriEscapeUnescape:
304
277
  Exclude:
@@ -657,14 +630,6 @@ Style/ConditionalAssignment:
657
630
  - 'spec/support/components/netzke_combobox.rb'
658
631
  - 'spec/support/components/netzke_grid.rb'
659
632
 
660
- # Offense count: 3
661
- # Cop supports --auto-correct.
662
- Style/DefWithParentheses:
663
- Exclude:
664
- - 'spec/dummy/db/migrate/20171221095312_create_gemini_my_rules.rb'
665
- - 'spec/dummy/db/migrate/20171221095359_create_gemini_xyz_rules.rb'
666
- - 'spec/dummy/public/extjs/classic/theme-base/sass/utils.rb'
667
-
668
633
  # Offense count: 181
669
634
  Style/Documentation:
670
635
  Enabled: false
@@ -683,26 +648,6 @@ Style/EachForSimpleLoop:
683
648
  Exclude:
684
649
  - 'spec/controllers/rpc_import_spec.rb'
685
650
 
686
- # Offense count: 2
687
- # Cop supports --auto-correct.
688
- Style/EachWithObject:
689
- Exclude:
690
- - 'lib/marty/util.rb'
691
- - 'lib/marty/xl.rb'
692
-
693
- # Offense count: 2
694
- # Cop supports --auto-correct.
695
- Style/EmptyCaseCondition:
696
- Exclude:
697
- - 'app/components/marty/base_rule_view.rb'
698
- - 'app/models/marty/data_grid.rb'
699
-
700
- # Offense count: 2
701
- # Cop supports --auto-correct.
702
- Style/EmptyLiteral:
703
- Exclude:
704
- - 'spec/dummy/public/extjs/classic/theme-base/sass/utils.rb'
705
-
706
651
  # Offense count: 8
707
652
  # Cop supports --auto-correct.
708
653
  # Configuration parameters: EnforcedStyle.
@@ -775,25 +720,6 @@ Style/GuardClause:
775
720
  - 'spec/lib/json_schema_spec.rb'
776
721
  - 'spec/support/post_run_logger.rb'
777
722
 
778
- # Offense count: 43
779
- # Cop supports --auto-correct.
780
- # Configuration parameters: EnforcedStyle, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
781
- # SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
782
- Style/HashSyntax:
783
- Exclude:
784
- - 'app/components/marty/simple_app.rb'
785
- - 'app/models/marty/user.rb'
786
- - 'app/models/marty/vw_promise.rb'
787
- - 'db/migrate/090_create_delayed_jobs.rb'
788
- - 'lib/marty/engine.rb'
789
- - 'lib/marty/migrations.rb'
790
- - 'spec/features/scripting_spec.rb'
791
- - 'spec/features/user_view_spec.rb'
792
- - 'spec/lib/json_schema_spec.rb'
793
- - 'spec/spec_helper.rb'
794
- - 'spec/support/netzke.rb'
795
- - 'spec/support/shared_connection.rb'
796
-
797
723
  # Offense count: 2
798
724
  Style/IdenticalConditionalBranches:
799
725
  Exclude:
@@ -1124,13 +1050,6 @@ Style/StructInheritance:
1124
1050
  - 'lib/marty/promise_job.rb'
1125
1051
  - 'lib/marty/promise_ruby_job.rb'
1126
1052
 
1127
- # Offense count: 75
1128
- # Cop supports --auto-correct.
1129
- # Configuration parameters: MinSize.
1130
- # SupportedStyles: percent, brackets
1131
- Style/SymbolArray:
1132
- EnforcedStyle: brackets
1133
-
1134
1053
  # Offense count: 7
1135
1054
  # Cop supports --auto-correct.
1136
1055
  # Configuration parameters: EnforcedStyle, AllowSafeAssignment.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- marty (2.7.1)
4
+ marty (2.7.2)
5
5
  aws-sigv4 (~> 1.0, >= 1.0.2)
6
6
  axlsx (= 3.0.0pre)
7
7
  coderay
@@ -278,12 +278,11 @@ class Marty::BaseRuleView < Marty::McflyGridPanel
278
278
  nullbool = h[:type] == :boolean && (h[:null] == true || !h.include?(:null))
279
279
  attribute name do |c|
280
280
  c.width = h[:width] || 150
281
- case
282
- when h[:type] == :datetime
281
+ if h[:type] == :datetime
283
282
  c.format = 'Y-m-d H:i'
284
- when h[:type] == :date
283
+ elsif h[:type] == :date
285
284
  c.format = 'Y-m-d'
286
- when nullbool
285
+ elsif nullbool
287
286
  c.type = :string
288
287
  enum_column(c, ['True', 'False'])
289
288
  else
@@ -304,7 +303,7 @@ class Marty::BaseRuleView < Marty::McflyGridPanel
304
303
  c.getter = Marty::BaseRuleView.jsonb_field_getter(meth, namestr, nullbool)
305
304
  c.setter = Marty::BaseRuleView.jsonb_field_setter(meth, namestr,
306
305
  h[:type] == :boolean)
307
- c.filter_with = lambda do |rel, value, op|
306
+ c.filter_with = lambda do |rel, value, _op|
308
307
  v = ActiveRecord::Base.connection.quote(value)[1..-2]
309
308
  rel.where("#{meth}->>'#{namestr}' like '%#{v}%'")
310
309
  end
@@ -342,7 +341,7 @@ class Marty::BaseRuleView < Marty::McflyGridPanel
342
341
  c.flex = 1
343
342
  c.getter = jsonb_getter(a.to_s)
344
343
  c.sorting_scope = json_sort_scope(a)
345
- c.filter_with = lambda do |rel, value, op|
344
+ c.filter_with = lambda do |rel, value, _op|
346
345
  v = ActiveRecord::Base.connection.quote(value)[1..-2]
347
346
  rel.where("#{a}::text like '%#{v}%'")
348
347
  end
@@ -390,12 +390,12 @@ class Marty::MainAuthApp < Marty::AuthApp
390
390
  c.klass = Marty::LogView
391
391
  end
392
392
 
393
- endpoint :reload_scripts do |params|
393
+ endpoint :reload_scripts do |_params|
394
394
  Marty::Script.load_scripts
395
395
  client.netzke_notify 'Scripts have been reloaded'
396
396
  end
397
397
 
398
- endpoint :load_seed do |params|
398
+ endpoint :load_seed do |_params|
399
399
  Rails.application.load_seed
400
400
  client.netzke_notify 'Seeds have been loaded'
401
401
  end
@@ -74,7 +74,7 @@ class Marty::PromiseView < Netzke::Tree::Base
74
74
  a.icon_cls = 'fa fa-sync-alt glyph'
75
75
  end
76
76
 
77
- endpoint :clear do |params|
77
+ endpoint :clear do |_params|
78
78
  Marty::Promise.cleanup(true)
79
79
  client.netzke_on_refresh
80
80
  end
@@ -69,33 +69,33 @@ class Marty::SimpleApp < Netzke::Base
69
69
  # Config for the main panel, which will contain dynamically loaded components.
70
70
  def main_panel_config(overrides = {})
71
71
  {
72
- :itemId => 'main_panel',
73
- :region => 'center',
74
- :layout => 'fit'
72
+ itemId: 'main_panel',
73
+ region: 'center',
74
+ layout: 'fit'
75
75
  }.merge(overrides)
76
76
  end
77
77
 
78
78
  # Config for the status bar
79
79
  def status_bar_config(overrides = {})
80
80
  {
81
- :itemId => 'status_bar',
82
- :xtype => 'statusbar',
83
- :region => 'south',
84
- :statusAlign => 'right',
85
- :busyText => 'Busy...',
86
- :default_text => 'Ready',
87
- :default_icon_cls => ''
81
+ itemId: 'status_bar',
82
+ xtype: 'statusbar',
83
+ region: 'south',
84
+ statusAlign: 'right',
85
+ busyText: 'Busy...',
86
+ default_text: 'Ready',
87
+ default_icon_cls: ''
88
88
  }.merge(overrides)
89
89
  end
90
90
 
91
91
  # Config for the menu bar
92
92
  def menu_bar_config(overrides = {})
93
93
  {
94
- :itemId => 'menu_bar',
95
- :layout => { overflow_handler: 'Menu' },
96
- :xtype => 'toolbar',
97
- :region => 'north',
98
- :items => menu
94
+ itemId: 'menu_bar',
95
+ layout: { overflow_handler: 'Menu' },
96
+ xtype: 'toolbar',
97
+ region: 'north',
98
+ items: menu
99
99
  }.merge(overrides)
100
100
  end
101
101
 
@@ -96,7 +96,7 @@ class Marty::BaseRule < Marty::Base
96
96
  "(#{field}#{arrow}'#{subfield}')#{fieldcast} #{op} #{value}"
97
97
  end
98
98
 
99
- def self.get_matches_(pt, attrs, params)
99
+ def self.get_matches_(_pt, attrs, params)
100
100
  q = select('DISTINCT ON (name) *').where(attrs)
101
101
 
102
102
  params.each do |k, vraw|
@@ -216,13 +216,25 @@ class Marty::DataGrid < Marty::Base
216
216
  res
217
217
  end
218
218
 
219
- cached_delorean_fn :lookup_grid_h, sig: 4 do |pt, dgn, h, distinct|
219
+ # this function is cached through lookup_grid_h_priv
220
+ delorean_fn :lookup_grid_h, sig: 4 do |pt, dgn, h, distinct|
220
221
  dgh = lookup_h(pt, dgn)
221
222
  raise "#{dgn} grid not found" unless dgh
222
223
  raise "non-hash arg #{h}" unless Hash === h
223
224
 
224
- res = lookup_grid_distinct_entry_h(pt, h, dgh, nil, true, false, distinct)
225
- res['result']
225
+ attrs = dgh['metadata'].map { |a| a['attr'] }
226
+
227
+ # Narrow hash to needed attrs -- makes the cache work a lot better
228
+ # in case the hash includes items not in grid attrs.
229
+ lookup_grid_h_priv(pt, dgh, h.slice(*attrs), distinct)
230
+ end
231
+
232
+ # private method used to cache lookup_grid_distinct_entry_h result
233
+ cached_delorean_fn :lookup_grid_h_priv,
234
+ private: true, sig: 4 do |pt, dgh, h, distinct|
235
+
236
+ lookup_grid_distinct_entry_h(
237
+ pt, h, dgh, nil, true, false, distinct)['result']
226
238
  end
227
239
 
228
240
  # FIXME: using cached_delorean_fn just for the caching -- this is
@@ -261,10 +273,9 @@ class Marty::DataGrid < Marty::Base
261
273
 
262
274
  res = vhash['result']
263
275
 
264
- v = case
265
- when ::Marty::EnumHelper.pg_enum?(klass: res)
276
+ v = if ::Marty::EnumHelper.pg_enum?(klass: res)
266
277
  c_data_type.find_by_name(res)
267
- when Marty::DataGrid == c_data_type
278
+ elsif Marty::DataGrid == c_data_type
268
279
  follow ?
269
280
  Marty::DataGrid.lookup_h(pt, res) :
270
281
  Marty::DataGrid.lookup(pt, res)
@@ -612,9 +623,9 @@ class Marty::DataGrid < Marty::Base
612
623
  end
613
624
  end
614
625
 
615
- removes.reject! { |dir, set| set.empty? }
626
+ removes.reject! { |_dir, set| set.empty? }
616
627
 
617
- removes.each do |dir, set|
628
+ removes.each do |dir, _set|
618
629
  metadata_copy.select { |m| m['dir'] == dir }.each do |meta|
619
630
  meta['keys'] = remove_indices(meta['keys'], removes[dir])
620
631
  end
@@ -100,7 +100,7 @@ class Marty::DeloreanRule < Marty::BaseRule
100
100
  result.err_section)
101
101
  end
102
102
  result.cg_hash = Hash[result.cg_keys.zip(result.cg_vals)]
103
- fails = result.cg_hash.select { |k, v| ![v].flatten.first }
103
+ fails = result.cg_hash.select { |_k, v| ![v].flatten.first }
104
104
  return fails if fails.present?
105
105
  end
106
106
 
@@ -202,7 +202,7 @@ class Marty::DeloreanRule < Marty::BaseRule
202
202
  proc do |old, new|
203
203
  klass.where(obsoleted_dt: 'infinity').each do |r|
204
204
  r.grids.each { |k, v| r.grids[k] = new if v == old }
205
- r.results.each do |k, v|
205
+ r.results.each do |k, _v|
206
206
  r.results[k] = %Q("#{new}") if
207
207
  k.ends_with?('_grid') && r.fixed_results[k] == old
208
208
  end
@@ -13,7 +13,7 @@ module Marty::PgEnum
13
13
  base.class_eval do
14
14
  extend ::Delorean::Functions unless respond_to?(:delorean_fn)
15
15
 
16
- delorean_fn :get_all do |pt = nil|
16
+ delorean_fn :get_all do |_pt = nil|
17
17
  self::VALUES.map(&:to_s)
18
18
  end
19
19
 
@@ -67,7 +67,7 @@ class Marty::Posting < Marty::Base
67
67
  q.order('created_dt DESC').first.attributes
68
68
  end
69
69
 
70
- def self.get_latest(limit, is_test = nil)
70
+ def self.get_latest(limit, _is_test = nil)
71
71
  # IMPORTANT: is_test arg is ignored (KEEP for backward compat.)
72
72
 
73
73
  q = where("created_dt <> 'infinity'").
@@ -2,7 +2,7 @@ class Marty::User < Marty::Base
2
2
  validates_presence_of :login, :firstname, :lastname
3
3
  validates_uniqueness_of :login
4
4
 
5
- validates_format_of :login, :with => /\A[a-z0-9_\-@\.]*\z/i
5
+ validates_format_of :login, with: /\A[a-z0-9_\-@\.]*\z/i
6
6
  validates_length_of :login, :firstname, :lastname, maximum: 100
7
7
 
8
8
  MARTY_IMPORT_UNIQUENESS = [:login]
@@ -66,6 +66,6 @@ class Marty::VwPromise < Marty::Base
66
66
  st = "%#{search_text}%"
67
67
  # Convert "Role Name" or "Role name" to "role_name" (underscore is key)
68
68
  st2 = "%#{search_text.titleize.gsub(/\s/, '').underscore}%"
69
- joins(:user => :roles).where(query, st, st, st, st2).distinct
69
+ joins(user: :roles).where(query, st, st, st, st2).distinct
70
70
  }
71
71
  end
@@ -224,7 +224,7 @@ class Marty::DataChange
224
224
  next
225
225
  end
226
226
 
227
- key_hash = conv.reject { |k, v| !keys.member?(k) }
227
+ key_hash = conv.reject { |k, _v| !keys.member?(k) }
228
228
 
229
229
  source = Marty::DataConversion.find_row(klass, key_hash, ts)
230
230
 
@@ -236,7 +236,7 @@ class Marty::DataChange
236
236
 
237
237
  found_sources << source
238
238
 
239
- non_key_hash = conv.reject { |k, v| keys.member?(k) }
239
+ non_key_hash = conv.reject { |k, _v| keys.member?(k) }
240
240
 
241
241
  # is source same as converted input?
242
242
  if non_key_hash.all? { |k, v| v == source.send(k) }
@@ -281,7 +281,7 @@ class Marty::DataChange
281
281
  ts = Mcfly.normalize_infinity(ts)
282
282
  col_types = Marty::DataConversion.col_types(klass)
283
283
 
284
- mcfly_cols = col_types.map do |attr, h|
284
+ mcfly_cols = col_types.map do |_attr, h|
285
285
  Hash === h && Mcfly.has_mcfly?(h[:assoc_class]) && h || nil
286
286
  end.compact
287
287
 
@@ -152,7 +152,7 @@ class Marty::DataConversion
152
152
 
153
153
  raise "no key_attrs for #{klass}" unless key_attrs
154
154
 
155
- find_options = options.select { |k, v| key_attrs.member? k.to_sym }
155
+ find_options = options.select { |k, _v| key_attrs.member? k.to_sym }
156
156
 
157
157
  raise "no keys for #{klass} -- #{options}" if find_options.empty?
158
158
 
@@ -32,7 +32,7 @@ module Marty
32
32
  preprocess_function,
33
33
  )
34
34
 
35
- recs.each_with_object(Hash.new(0)) do |(op, id), h|
35
+ recs.each_with_object(Hash.new(0)) do |(op, _id), h|
36
36
  h[op] += 1
37
37
  end
38
38
  end
data/lib/marty/engine.rb CHANGED
@@ -9,7 +9,7 @@ module Marty
9
9
 
10
10
  # generators add rspec tests
11
11
  config.generators do |g|
12
- g.test_framework :rspec, :view_specs => false
12
+ g.test_framework :rspec, view_specs: false
13
13
  end
14
14
  end
15
15
  end
@@ -4,7 +4,7 @@ module Marty
4
4
  private
5
5
 
6
6
  class PgEnumAttribute < JSON::Schema::Attribute
7
- def self.validate(curr_schema, data, frag, pro, validator, opt = {})
7
+ def self.validate(curr_schema, data, frag, pro, _validator, opt = {})
8
8
  values = nil
9
9
  path = '#/' + frag.join('/')
10
10
  begin
@@ -70,7 +70,7 @@ module Mcfly::Model
70
70
  end.join(' AND ')
71
71
 
72
72
  if Hash === attrs
73
- order = attrs.select { |k, v| v }.keys.reverse.map do |k|
73
+ order = attrs.select { |_k, v| v }.keys.reverse.map do |k|
74
74
  k = "#{k}_id" if assoc.member?(k)
75
75
 
76
76
  "#{k} NULLS LAST"
@@ -82,9 +82,9 @@ module Mcfly::Model
82
82
 
83
83
  fn = cache ? :cached_delorean_fn : :delorean_fn
84
84
  base_mcfly_lookup(fn, name, options + { sig: attrs.length + 1,
85
- mode: mode }) do |t, *attr_list|
85
+ mode: mode }) do |_t, *attr_list|
86
86
 
87
- attr_list_ids = attr_list.each_with_index.map do |x, i|
87
+ attr_list_ids = attr_list.each_with_index.map do |_x, i|
88
88
  assoc.member?(attrs[i]) ?
89
89
  (attr_list[i] && attr_list[i].id) : attr_list[i]
90
90
  end
@@ -141,7 +141,7 @@ module Marty::Migrations
141
141
  end
142
142
  end
143
143
  elsif !excludes.include?(c)
144
- assoc = klass.reflections.find { |(n, h)| h.foreign_key == c }
144
+ assoc = klass.reflections.find { |(_n, h)| h.foreign_key == c }
145
145
  if assoc && assoc[1].klass.columns_hash['name']
146
146
  table_name = assoc[1].table_name
147
147
  jointabs[table_name] ||= 0
@@ -182,8 +182,8 @@ EOSQL
182
182
 
183
183
  def self.lines_to_crlf(lines)
184
184
  lines.map do |line|
185
- line.encode(line.encoding, :universal_newline => true).
186
- encode(line.encoding, :crlf_newline => true)
185
+ line.encode(line.encoding, universal_newline: true).
186
+ encode(line.encoding, crlf_newline: true)
187
187
  end
188
188
  end
189
189
 
@@ -198,7 +198,7 @@ EOSQL
198
198
  version: m[2].to_i,
199
199
  raw_sql: "#{md}/sql/#{m[1]}_v#{m[2]}_sql_#{m[3]}.sql"
200
200
  }
201
- end.group_by { |a| a[:name] }.each do |k, v|
201
+ end.group_by { |a| a[:name] }.each do |_k, v|
202
202
  v.sort! { |a, b| b[:version] <=> a[:version] }
203
203
  end
204
204
  time_now = Time.now.utc
data/lib/marty/monkey.rb CHANGED
@@ -210,7 +210,7 @@ module Netzke::Basepack::DataAdapters
210
210
  predicates[1..-1].inject(predicates.first) { |r, p| r.and(p) }
211
211
  end
212
212
 
213
- def update_predecate_for_enum(table, op, value)
213
+ def update_predecate_for_enum(table, _op, value)
214
214
  col = Arel::Nodes::NamedFunction.new('CAST', [table.as('TEXT')])
215
215
  col.matches "%#{value}%"
216
216
  end
@@ -31,7 +31,7 @@ class Marty::PromiseProxy < BasicObject
31
31
  @promise
32
32
  end
33
33
 
34
- def is_a?(c)
34
+ def is_a?(_c)
35
35
  # Marty::PromiseProxy == c
36
36
  # {}.is_a? c
37
37
 
@@ -47,7 +47,7 @@ class Marty::RuleScriptSet < Delorean::AbstractContainer
47
47
  dgid.ends_with?('_grid') ? dgid + '_result' : dgid + '_grid_result'
48
48
  end
49
49
 
50
- def expand_grid_code(h, dgid, dgname, cache, extra_params)
50
+ def expand_grid_code(h, dgid, dgname, cache, _extra_params)
51
51
  final_name = self.class.grid_final_name(dgid)
52
52
  if cache[dgname]
53
53
  h[final_name] = (cache[dgname]).to_s
@@ -133,7 +133,7 @@ class Marty::RuleScriptSet < Delorean::AbstractContainer
133
133
  acc + [acc.last + len]
134
134
  end
135
135
  ranges = oh.keys.zip(ranges0.each_cons(2).to_a)
136
- secnm, (st, en) = ranges.detect do |sec, (st, en)|
136
+ secnm, (st, en) = ranges.detect do |_sec, (st, en)|
137
137
  line.between?(st, en - 1)
138
138
  end
139
139
  [secnm, line - st + 1]
data/lib/marty/util.rb CHANGED
@@ -100,9 +100,8 @@ module Marty::Util
100
100
  when Array
101
101
  obj.map { |o| deep_round(o, digits) }
102
102
  when Hash
103
- obj.inject({}) do |result, (key, value)|
103
+ obj.each_with_object({}) do |(key, value), result|
104
104
  result[key] = deep_round(value, digits)
105
- result
106
105
  end
107
106
  else
108
107
  obj.is_a?(Float) ? obj.round(digits) : obj
data/lib/marty/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Marty
2
- VERSION = '2.7.1'
2
+ VERSION = '2.7.2'
3
3
  end
data/lib/marty/xl.rb CHANGED
@@ -521,10 +521,9 @@ class Marty::Xl
521
521
  when Array
522
522
  obj.map { |x| symbolize_keys(x, sym_str) }
523
523
  when Hash
524
- obj.inject({}) do |result, (key, value)|
524
+ obj.each_with_object({}) do |(key, value), result|
525
525
  key = key.to_sym if key.is_a?(String)
526
526
  result[key] = symbolize_keys(value, sym_str)
527
- result
528
527
  end
529
528
  when String
530
529
  (sym_str && obj.starts_with?(sym_str)) ? obj[sym_str.length..-1].to_sym : obj
@@ -50,7 +50,7 @@ class Marty::Api::Base
50
50
  ).pluck(:app_name).first
51
51
  end
52
52
 
53
- def self.evaluate params, request, config
53
+ def self.evaluate params, _request, config
54
54
  # prevent script evaluation from modifying passed in params
55
55
  params = params.deep_dup
56
56
 
@@ -234,7 +234,7 @@ class Marty::Api::Base
234
234
  errs.map { |err| _get_errors(err) }
235
235
  elsif errs.is_a?(Hash)
236
236
  if !errs.include?(:failed_attribute)
237
- errs.map { |k, v| _get_errors(v) }
237
+ errs.map { |_k, v| _get_errors(v) }
238
238
  else
239
239
  fa, fragment, message, errors = errs.values_at(:failed_attribute,
240
240
  :fragment,
@@ -35,7 +35,7 @@ module Marty::Diagnostic; class Nodes < Base
35
35
  'terminated' => error_if(instances.terminated),
36
36
  'stopping' => error_if(instances.stopping),
37
37
  'stopped' => error_if(instances.stopped),
38
- }.delete_if { |k, v| v.empty? }
38
+ }.delete_if { |_k, v| v.empty? }
39
39
  rescue StandardError => e
40
40
  error(e.message)
41
41
  end
@@ -35,7 +35,7 @@ module Marty::Diagnostic
35
35
 
36
36
  # generate version data and declare all values consistent
37
37
  versions = Version.generate.each_with_object({}) do |(n, v), h|
38
- h[n] = v.each { |t, r| r['consistent'] = true }
38
+ h[n] = v.each { |_t, r| r['consistent'] = true }
39
39
  end
40
40
 
41
41
  expected = {
@@ -76,7 +76,7 @@ DD: BB
76
76
  result = 444
77
77
  DELOREAN
78
78
 
79
- with_user('dev1') do |u|
79
+ with_user('dev1') do |_u|
80
80
  Marty::Posting.do_create('BASE', SOME_DT, 'a comment')
81
81
 
82
82
  Marty::Script.
@@ -85,7 +85,7 @@ feature 'under Applications menu, Scripting workflows', js: true do
85
85
  and_by 'select the new script' do
86
86
  wait_for_ajax
87
87
  within(:gridpanel, 'script_grid', match: :first) do
88
- expect(script_grid.get_row_vals(6)).to netzke_include(:name => 'Xyz', :tag => 'DEV')
88
+ expect(script_grid.get_row_vals(6)).to netzke_include(name: 'Xyz', tag: 'DEV')
89
89
  script_grid.select_row(6)
90
90
  end
91
91
  end
@@ -289,7 +289,7 @@ feature 'under Applications menu, Scripting workflows', js: true do
289
289
  wait_for_ajax
290
290
  script_grid.select_row(5)
291
291
  expect(page).to have_content '1 #123 2 #456'
292
- expect(tag_grid.get_row_vals(2)).to netzke_include(:comment => 'ABCD')
292
+ expect(tag_grid.get_row_vals(2)).to netzke_include(comment: 'ABCD')
293
293
  end
294
294
  end
295
295
 
@@ -45,7 +45,7 @@ C:
45
45
  a = 456.0 + p0
46
46
  DELOREAN
47
47
 
48
- with_user('dev1') do |u|
48
+ with_user('dev1') do |_u|
49
49
  Marty::Script.
50
50
  load_script_bodies({
51
51
  'M1' => sample_script,
@@ -74,7 +74,7 @@ B: A
74
74
  p =? 5
75
75
  DELOREAN
76
76
 
77
- with_user('dev1') do |u|
77
+ with_user('dev1') do |_u|
78
78
  Marty::Script.
79
79
  load_script_bodies({
80
80
  'M3' => sample_script2,
@@ -78,11 +78,11 @@ feature 'under Sytem menu, User Management worflows', js: true do
78
78
  and_by 'check row got edited' do
79
79
  wait_for_ajax
80
80
  expect(user_view.get_row_vals(2)).to netzke_include(
81
- :login => 'new_login',
82
- :firstname => 'new_fname',
83
- :lastname => 'new_lname',
84
- :active => true,
85
- :roles => 'User Manager,Viewer',
81
+ login: 'new_login',
82
+ firstname: 'new_fname',
83
+ lastname: 'new_lname',
84
+ active: true,
85
+ roles: 'User Manager,Viewer',
86
86
  )
87
87
  end
88
88
 
@@ -26,9 +26,9 @@ module Marty
26
26
  },
27
27
  }
28
28
  }
29
- opt = { :validate_schema => true,
30
- :errors_as_objects => false,
31
- :version => Marty::JsonSchema::RAW_URI }
29
+ opt = { validate_schema: true,
30
+ errors_as_objects: false,
31
+ version: Marty::JsonSchema::RAW_URI }
32
32
 
33
33
  it 'returns no error on correct simple data' do
34
34
  data = { 'a' => 5 }
@@ -625,7 +625,7 @@ module Marty
625
625
  ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ###
626
626
 
627
627
  class FloorOf8 < JSON::Schema::Attribute
628
- def self.validate(curr_schema, data, frag, processor, validator, opt)
628
+ def self.validate(curr_schema, data, frag, processor, _validator, opt)
629
629
  if data < 8
630
630
  msg = 'Error at FloorOf8: Value is below 8'
631
631
  validation_error(processor,
@@ -639,7 +639,7 @@ module Marty
639
639
  end
640
640
 
641
641
  class CeilingOf20 < JSON::Schema::Attribute
642
- def self.validate(curr_schema, data, frag, processor, validator, opt)
642
+ def self.validate(curr_schema, data, frag, processor, _validator, opt)
643
643
  if data > 20
644
644
  msg = 'Error at CeilingOf20: Value exceeds 20'
645
645
  validation_error(processor,
data/spec/lib/xl_spec.rb CHANGED
@@ -88,7 +88,7 @@ describe Marty::Xl do
88
88
  Delorean::Engine.new 'YYY'
89
89
  end
90
90
 
91
- def worksheet(ind, c)
91
+ def worksheet(_ind, c)
92
92
  code = CODE.clone
93
93
  map = { 'C1' => c[0].to_s, 'C2' => c[1].to_s }
94
94
  map.each { |k, v| code.sub!(k, v) }
data/spec/spec_helper.rb CHANGED
@@ -42,7 +42,7 @@ RSpec.configure do |config|
42
42
  marty_whodunnit
43
43
  end
44
44
 
45
- config.after(:each, :js => true) do |example|
45
+ config.after(:each, js: true) do |example|
46
46
  # save a screenshot on js failures for CI server testing
47
47
  if example.exception
48
48
  meta = example.metadata
@@ -265,7 +265,7 @@ module Marty; module RSpec; module Components
265
265
  res
266
266
  end
267
267
 
268
- def end_edit(row, field)
268
+ def end_edit(_row, _field)
269
269
  run_js <<-JS
270
270
  #{ext_var(grid, 'grid')}
271
271
  #{ext_var(ext_celleditor, 'editor')}
@@ -383,7 +383,7 @@ module Marty; module RSpec; module Components
383
383
  JS
384
384
  end
385
385
 
386
- def end_edit(row, field)
386
+ def end_edit(_row, _field)
387
387
  run_js <<-JS
388
388
  #{ext_var(grid, 'grid')}
389
389
  #{ext_var(ext_celleditor, 'editor')}
@@ -1,7 +1,7 @@
1
1
  module Marty; module RSpec; module Netzke
2
2
  MAX_WAIT_TIME = 5.0
3
3
 
4
- def by message, level = 0
4
+ def by message, _level = 0
5
5
  wait_for_ready(10)
6
6
  pending(message) unless block_given?
7
7
  yield
@@ -30,8 +30,8 @@ module Marty; module RSpec; module Netzke
30
30
  end
31
31
 
32
32
  find(:xpath, '//span', text: 'Sign in', match: :first, wait: 5).click
33
- fill_in('login', :with => username)
34
- fill_in('password', :with => password)
33
+ fill_in('login', with: username)
34
+ fill_in('password', with: password)
35
35
  press('OK')
36
36
  wait_for_ajax
37
37
  end
@@ -64,7 +64,7 @@ module Marty; module RSpec; module Netzke
64
64
  end
65
65
  end
66
66
 
67
- def popup message = ''
67
+ def popup _message = ''
68
68
  wait_for_ready
69
69
  yield if block_given?
70
70
  close_window
@@ -20,12 +20,12 @@ module Marty; module RSpec; module SharedConnection
20
20
  def self.connection
21
21
  EXCL_LAMBDA.call.include?(model_name) ? orig_connection :
22
22
  @@shared_connection ||
23
- ConnectionPool::Wrapper.new(:size => 1) { retrieve_connection }
23
+ ConnectionPool::Wrapper.new(size: 1) { retrieve_connection }
24
24
  end
25
25
 
26
26
  def self.reset_shared_connection
27
27
  @@shared_connection = ConnectionPool::Wrapper.
28
- new(:size => 1) { retrieve_connection }
28
+ new(size: 1) { retrieve_connection }
29
29
  end
30
30
  end
31
31
  end end end
@@ -13,7 +13,7 @@ module Marty; module RSpec; module Users
13
13
 
14
14
  role = Marty::Role.find_by_name(role_name.to_s)
15
15
 
16
- rails "Oops unknown role: #{role_name}. Was db seeded?" unless role
16
+ raise "Oops unknown role: #{role_name}. Was db seeded?" unless role
17
17
 
18
18
  user_role = Marty::UserRole.new
19
19
  user_role.user = user
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: 2.7.1
4
+ version: 2.7.2
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-06-06 00:00:00.000000000 Z
17
+ date: 2019-06-07 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: pg