Correct style errors identified by the latest version of RuboCop
diff --git a/src/ruby/.rubocop_todo.yml b/src/ruby/.rubocop_todo.yml
index d5bb55e..d9fe0a5 100644
--- a/src/ruby/.rubocop_todo.yml
+++ b/src/ruby/.rubocop_todo.yml
@@ -1,42 +1,30 @@
# This configuration was generated by `rubocop --auto-gen-config`
-# on 2015-01-16 02:30:04 -0800 using RuboCop version 0.28.0.
+# on 2015-04-14 09:35:44 -0700 using RuboCop version 0.29.1.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.
-# Offense count: 3
-# Lint/UselessAssignment:
-# Enabled: false
-
-# Offense count: 33
+# Offense count: 32
Metrics/AbcSize:
- Max: 39
-
-# Offense count: 3
-# Configuration parameters: CountComments.
-Metrics/ClassLength:
- Max: 231
+ Max: 36
# Offense count: 2
-Metrics/CyclomaticComplexity:
- Max: 8
+# Configuration parameters: CountComments.
+Metrics/ClassLength:
+ Max: 183
-# Offense count: 36
+# Offense count: 35
# Configuration parameters: CountComments.
Metrics/MethodLength:
- Max: 37
+ Max: 36
-# Offense count: 8
+# Offense count: 7
# Configuration parameters: CountKeywordArgs.
Metrics/ParameterLists:
Max: 8
-# Offense count: 2
-Metrics/PerceivedComplexity:
- Max: 10
-
-# Offense count: 7
+# Offense count: 6
# Configuration parameters: AllowedVariables.
Style/GlobalVars:
Enabled: false
@@ -50,3 +38,7 @@
# Configuration parameters: Methods.
Style/SingleLineBlockParams:
Enabled: false
+
+# Offense count: 1
+Style/StructInheritance:
+ Enabled: false
diff --git a/src/ruby/spec/channel_spec.rb b/src/ruby/spec/channel_spec.rb
index 31e38d7..d471ff5 100644
--- a/src/ruby/spec/channel_spec.rb
+++ b/src/ruby/spec/channel_spec.rb
@@ -58,7 +58,7 @@
it 'does not take a hash with bad values as channel args' do
blk = construct_with_args(symbol: Object.new)
expect(&blk).to raise_error TypeError
- blk = construct_with_args('1' => Hash.new)
+ blk = construct_with_args('1' => {})
expect(&blk).to raise_error TypeError
end
diff --git a/src/ruby/spec/client_server_spec.rb b/src/ruby/spec/client_server_spec.rb
index 1a2afbe..68af79f 100644
--- a/src/ruby/spec/client_server_spec.rb
+++ b/src/ruby/spec/client_server_spec.rb
@@ -192,11 +192,11 @@
describe 'from client => server' do
before(:example) do
n = 7 # arbitrary number of metadata
- diff_keys_fn = proc { |i| [sprintf('k%d', i), sprintf('v%d', i)] }
+ diff_keys_fn = proc { |i| [format('k%d', i), format('v%d', i)] }
diff_keys = Hash[n.times.collect { |x| diff_keys_fn.call x }]
- null_vals_fn = proc { |i| [sprintf('k%d', i), sprintf('v\0%d', i)] }
+ null_vals_fn = proc { |i| [format('k%d', i), format('v\0%d', i)] }
null_vals = Hash[n.times.collect { |x| null_vals_fn.call x }]
- same_keys_fn = proc { |i| [sprintf('k%d', i), [sprintf('v%d', i)] * n] }
+ same_keys_fn = proc { |i| [format('k%d', i), [format('v%d', i)] * n] }
same_keys = Hash[n.times.collect { |x| same_keys_fn.call x }]
symbol_key = { a_key: 'a val' }
@valid_metadata = [diff_keys, same_keys, null_vals, symbol_key]
@@ -242,11 +242,11 @@
describe 'from server => client' do
before(:example) do
n = 7 # arbitrary number of metadata
- diff_keys_fn = proc { |i| [sprintf('k%d', i), sprintf('v%d', i)] }
+ diff_keys_fn = proc { |i| [format('k%d', i), format('v%d', i)] }
diff_keys = Hash[n.times.collect { |x| diff_keys_fn.call x }]
- null_vals_fn = proc { |i| [sprintf('k%d', i), sprintf('v\0%d', i)] }
+ null_vals_fn = proc { |i| [format('k%d', i), format('v\0%d', i)] }
null_vals = Hash[n.times.collect { |x| null_vals_fn.call x }]
- same_keys_fn = proc { |i| [sprintf('k%d', i), [sprintf('v%d', i)] * n] }
+ same_keys_fn = proc { |i| [format('k%d', i), [format('v%d', i)] * n] }
same_keys = Hash[n.times.collect { |x| same_keys_fn.call x }]
symbol_key = { a_key: 'a val' }
@valid_metadata = [diff_keys, same_keys, null_vals, symbol_key]
diff --git a/src/ruby/spec/server_spec.rb b/src/ruby/spec/server_spec.rb
index a47e484..bb566d1 100644
--- a/src/ruby/spec/server_spec.rb
+++ b/src/ruby/spec/server_spec.rb
@@ -152,7 +152,7 @@
it 'does not take a hash with bad values as channel args' do
blk = construct_with_args(symbol: Object.new)
expect(&blk).to raise_error TypeError
- blk = construct_with_args('1' => Hash.new)
+ blk = construct_with_args('1' => {})
expect(&blk).to raise_error TypeError
end