You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@avro.apache.org by tj...@apache.org on 2021/05/15 14:47:15 UTC
[avro] 01/03: Upgrade to rubocop v1.x
This is an automated email from the ASF dual-hosted git repository.
tjwp pushed a commit to branch tjwp-rubocop-1.14
in repository https://gitbox.apache.org/repos/asf/avro.git
commit 67f6dc0d5a2d9752c2698ba55115fa642164f6cd
Author: Tim Perkins <tj...@users.noreply.github.com>
AuthorDate: Sat May 8 12:21:22 2021 -0400
Upgrade to rubocop v1.x
---
lang/ruby/.rubocop.yml | 1 +
lang/ruby/Gemfile | 4 ++--
lang/ruby/lib/avro/schema.rb | 2 +-
lang/ruby/test/tool.rb | 8 ++++----
4 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/lang/ruby/.rubocop.yml b/lang/ruby/.rubocop.yml
index 9537102..03d389f 100644
--- a/lang/ruby/.rubocop.yml
+++ b/lang/ruby/.rubocop.yml
@@ -17,6 +17,7 @@
AllCops:
TargetRubyVersion: 2.6
NewCops: disable
+ SuggestExtensions: false
Bundler:
Enabled: false
diff --git a/lang/ruby/Gemfile b/lang/ruby/Gemfile
index 9756e0f..ea255e4 100644
--- a/lang/ruby/Gemfile
+++ b/lang/ruby/Gemfile
@@ -25,6 +25,6 @@ gem 'parallel'
# webrick is no longer included with Ruby 3.0+
gem 'webrick'
-# rubocop v1.0 and later introduces new Lint cops to be addressed
-gem 'rubocop', '< 1.0'
+# next major version will enable new cops
+gem 'rubocop', '< 2'
gem 'rdoc'
diff --git a/lang/ruby/lib/avro/schema.rb b/lang/ruby/lib/avro/schema.rb
index eba379f..86f8b42 100644
--- a/lang/ruby/lib/avro/schema.rb
+++ b/lang/ruby/lib/avro/schema.rb
@@ -548,7 +548,7 @@ module Avro
class Field < Schema
attr_reader :type, :name, :default, :order, :doc, :aliases
- def initialize(type, name, default=:no_default, order=nil, names=nil, namespace=nil, doc=nil, aliases=nil)
+ def initialize(type, name, default=:no_default, order=nil, names=nil, namespace=nil, doc=nil, aliases=nil) # rubocop:disable Lint/MissingSuper
@type = subparse(type, names, namespace)
@name = name
@default = default
diff --git a/lang/ruby/test/tool.rb b/lang/ruby/test/tool.rb
index 64732a7..c91ae43 100644
--- a/lang/ruby/test/tool.rb
+++ b/lang/ruby/test/tool.rb
@@ -101,9 +101,9 @@ def main
if ARGV.size > 4
case ARGV[4]
when "-file"
- Avro::DataFile.open(ARGV[5]) {|f|
- f.each{|e| datum = e; break }
- }
+ Avro::DataFile.open(ARGV[5]) do |f|
+ datum = f.first
+ end
when "-data"
puts "JSON Decoder not yet implemented."
return 1
@@ -125,7 +125,7 @@ def main
if ARGV.size > 4
case ARGV[4]
when "-file"
- Avro::DataFile.open(ARGV[5]){|f| f.each{|e| datum = e; break } }
+ Avro::DataFile.open(ARGV[5]){ |f| datum = f.first }
when "-data"
puts "JSON Decoder not yet implemented"
return 1