From 672fce3aed2d68e7362dc5cfeb72df78f30eb3a2 Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Tue, 20 Jun 2017 15:37:38 -0700 Subject: Switch from reek/rubocop to chefstyle Reek doesn't work with modern Rake Signed-off-by: Tim Smith --- lib/ffi_yajl/benchmark/encode.rb | 16 +++++++-------- lib/ffi_yajl/benchmark/encode_json_and_marshal.rb | 18 ++++++++--------- lib/ffi_yajl/benchmark/encode_json_and_yaml.rb | 22 ++++++++++----------- lib/ffi_yajl/benchmark/encode_profile.rb | 10 +++++----- lib/ffi_yajl/benchmark/http.rb | 24 +++++++++++------------ lib/ffi_yajl/benchmark/parse.rb | 16 +++++++-------- lib/ffi_yajl/benchmark/parse_json_and_marshal.rb | 20 +++++++++---------- lib/ffi_yajl/benchmark/parse_json_and_yaml.rb | 22 ++++++++++----------- lib/ffi_yajl/benchmark/parse_profile.rb | 10 +++++----- lib/ffi_yajl/benchmark/parse_profile_ruby_prof.rb | 8 ++++---- lib/ffi_yajl/benchmark/parse_stream.rb | 18 ++++++++--------- 11 files changed, 92 insertions(+), 92 deletions(-) (limited to 'lib/ffi_yajl/benchmark') diff --git a/lib/ffi_yajl/benchmark/encode.rb b/lib/ffi_yajl/benchmark/encode.rb index fc03c06..17e12cc 100644 --- a/lib/ffi_yajl/benchmark/encode.rb +++ b/lib/ffi_yajl/benchmark/encode.rb @@ -1,26 +1,26 @@ # Portions Originally Copyright (c) 2008-2011 Brian Lopez - http://github.com/brianmario # See MIT-LICENSE -require 'rubygems' -require 'benchmark' -require 'stringio' +require "rubygems" +require "benchmark" +require "stringio" if !defined?(RUBY_ENGINE) || RUBY_ENGINE !~ /jruby/ begin - require 'yajl' + require "yajl" rescue LoadError puts "INFO: yajl-ruby not installed" end else puts "INFO: skipping yajl-ruby on jruby" end -require 'ffi_yajl' +require "ffi_yajl" begin - require 'json' + require "json" rescue LoadError puts "INFO: json gem not installed" end begin - require 'oj' + require "oj" rescue LoadError puts "INFO: oj gem not installed" end @@ -31,7 +31,7 @@ module FFI_Yajl def run # filename = ARGV[0] || 'benchmark/subjects/ohai.json' filename = File.expand_path(File.join(File.dirname(__FILE__), "subjects", "ohai.json")) - hash = File.open(filename, 'rb') { |f| FFI_Yajl::Parser.parse(f.read) } + hash = File.open(filename, "rb") { |f| FFI_Yajl::Parser.parse(f.read) } times = ARGV[1] ? ARGV[1].to_i : 1000 puts "Starting benchmark encoding #{filename} #{times} times\n\n" diff --git a/lib/ffi_yajl/benchmark/encode_json_and_marshal.rb b/lib/ffi_yajl/benchmark/encode_json_and_marshal.rb index e9d19bc..4269056 100644 --- a/lib/ffi_yajl/benchmark/encode_json_and_marshal.rb +++ b/lib/ffi_yajl/benchmark/encode_json_and_marshal.rb @@ -1,18 +1,18 @@ -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/..') -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib') +$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + "/..") +$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + "/../lib") -require 'rubygems' -require 'benchmark' -require 'yajl' -require 'stringio' +require "rubygems" +require "benchmark" +require "yajl" +require "stringio" begin - require 'json' + require "json" rescue LoadError end times = ARGV[0] ? ARGV[0].to_i : 1000 -filename = 'benchmark/subjects/ohai.json' -json = File.new(filename, 'r') +filename = "benchmark/subjects/ohai.json" +json = File.new(filename, "r") hash = Yajl::Parser.new.parse(json) json.close diff --git a/lib/ffi_yajl/benchmark/encode_json_and_yaml.rb b/lib/ffi_yajl/benchmark/encode_json_and_yaml.rb index 33dbbb2..72310c1 100644 --- a/lib/ffi_yajl/benchmark/encode_json_and_yaml.rb +++ b/lib/ffi_yajl/benchmark/encode_json_and_yaml.rb @@ -1,18 +1,18 @@ -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/..') -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib') +$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + "/..") +$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + "/../lib") -require 'rubygems' -require 'benchmark' -require 'yajl' +require "rubygems" +require "benchmark" +require "yajl" begin - require 'json' + require "json" rescue LoadError end -require 'yaml' +require "yaml" # JSON Section -filename = 'benchmark/subjects/ohai.json' -json = File.new(filename, 'r') +filename = "benchmark/subjects/ohai.json" +json = File.new(filename, "r") hash = Yajl::Parser.new.parse(json) json.close @@ -33,8 +33,8 @@ Benchmark.bmbm do |x| end # YAML Section -filename = 'benchmark/subjects/ohai.yml' -yml = File.new(filename, 'r') +filename = "benchmark/subjects/ohai.yml" +yml = File.new(filename, "r") data = YAML.load_stream(yml) yml.close diff --git a/lib/ffi_yajl/benchmark/encode_profile.rb b/lib/ffi_yajl/benchmark/encode_profile.rb index 36b92c7..468f88b 100644 --- a/lib/ffi_yajl/benchmark/encode_profile.rb +++ b/lib/ffi_yajl/benchmark/encode_profile.rb @@ -1,15 +1,15 @@ # Portions Originally Copyright (c) 2008-2011 Brian Lopez - http://github.com/brianmario # See MIT-LICENSE -require 'rubygems' -require 'ffi_yajl' +require "rubygems" +require "ffi_yajl" begin - require 'perftools' + require "perftools" rescue LoadError puts "INFO: perftools.rb gem not installed" end -ENV['CPUPROFILE_FREQUENCY'] = "4000" +ENV["CPUPROFILE_FREQUENCY"] = "4000" module FFI_Yajl class Benchmark @@ -18,7 +18,7 @@ module FFI_Yajl return unless defined?(PerfTools) filename = File.expand_path(File.join(File.dirname(__FILE__), "subjects", "ohai.json")) - hash = File.open(filename, 'rb') { |f| FFI_Yajl::Parser.parse(f.read) } + hash = File.open(filename, "rb") { |f| FFI_Yajl::Parser.parse(f.read) } times = 1000 puts "Starting profiling encoding #{filename} #{times} times\n\n" diff --git a/lib/ffi_yajl/benchmark/http.rb b/lib/ffi_yajl/benchmark/http.rb index b94a46c..0b19387 100644 --- a/lib/ffi_yajl/benchmark/http.rb +++ b/lib/ffi_yajl/benchmark/http.rb @@ -1,17 +1,17 @@ -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/..') -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib') +$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + "/..") +$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + "/../lib") -require 'rubygems' -require 'benchmark' -require 'yajl/http_stream' -require 'yajl/gzip' -require 'yajl/deflate' -require 'yajl/bzip2' unless defined?(Bzip2) -require 'json' -require 'uri' -require 'net/http' +require "rubygems" +require "benchmark" +require "yajl/http_stream" +require "yajl/gzip" +require "yajl/deflate" +require "yajl/bzip2" unless defined?(Bzip2) +require "json" +require "uri" +require "net/http" -uri = URI.parse('http://search.twitter.com/search.json?q=github') +uri = URI.parse("http://search.twitter.com/search.json?q=github") # uri = URI.parse('http://localhost/yajl-ruby.git/benchmark/subjects/contacts.json') times = ARGV[0] ? ARGV[0].to_i : 1 diff --git a/lib/ffi_yajl/benchmark/parse.rb b/lib/ffi_yajl/benchmark/parse.rb index 6aacc94..ad0091c 100644 --- a/lib/ffi_yajl/benchmark/parse.rb +++ b/lib/ffi_yajl/benchmark/parse.rb @@ -1,10 +1,10 @@ -require 'rubygems' -require 'benchmark' -require 'yajl' -require 'ffi_yajl' +require "rubygems" +require "benchmark" +require "yajl" +require "ffi_yajl" if !defined?(RUBY_ENGINE) || RUBY_ENGINE !~ /jruby/ begin - require 'yajl' + require "yajl" rescue LoadError puts "INFO: yajl-ruby not installed" end @@ -12,11 +12,11 @@ else puts "INFO: skipping yajl-ruby on jruby" end begin - require 'json' + require "json" rescue LoadError end begin - require 'oj' + require "oj" rescue LoadError end @@ -25,7 +25,7 @@ module FFI_Yajl class Parse def run filename = File.expand_path(File.join(File.dirname(__FILE__), "subjects", "item.json")) - json = File.new(filename, 'r') + json = File.new(filename, "r") json_str = json.read times = ARGV[1] ? ARGV[1].to_i : 10_000 diff --git a/lib/ffi_yajl/benchmark/parse_json_and_marshal.rb b/lib/ffi_yajl/benchmark/parse_json_and_marshal.rb index cd07d46..1148ebc 100644 --- a/lib/ffi_yajl/benchmark/parse_json_and_marshal.rb +++ b/lib/ffi_yajl/benchmark/parse_json_and_marshal.rb @@ -1,19 +1,19 @@ -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/..') -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib') +$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + "/..") +$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + "/../lib") -require 'rubygems' -require 'benchmark' -require 'yajl' +require "rubygems" +require "benchmark" +require "yajl" begin - require 'json' + require "json" rescue LoadError end # JSON section -filename = 'benchmark/subjects/ohai.json' -marshal_filename = 'benchmark/subjects/ohai.marshal_dump' -json = File.new(filename, 'r') -marshal_file = File.new(marshal_filename, 'r') +filename = "benchmark/subjects/ohai.json" +marshal_filename = "benchmark/subjects/ohai.marshal_dump" +json = File.new(filename, "r") +marshal_file = File.new(marshal_filename, "r") hash = {} diff --git a/lib/ffi_yajl/benchmark/parse_json_and_yaml.rb b/lib/ffi_yajl/benchmark/parse_json_and_yaml.rb index 6e479ce..b55d916 100644 --- a/lib/ffi_yajl/benchmark/parse_json_and_yaml.rb +++ b/lib/ffi_yajl/benchmark/parse_json_and_yaml.rb @@ -1,18 +1,18 @@ -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/..') -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib') +$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + "/..") +$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + "/../lib") -require 'rubygems' -require 'benchmark' -require 'yajl' +require "rubygems" +require "benchmark" +require "yajl" begin - require 'json' + require "json" rescue LoadError end -require 'yaml' +require "yaml" # JSON section -filename = 'benchmark/subjects/ohai.json' -json = File.new(filename, 'r') +filename = "benchmark/subjects/ohai.json" +json = File.new(filename, "r") times = ARGV[0] ? ARGV[0].to_i : 1000 puts "Starting benchmark parsing #{File.size(filename)} bytes of JSON data #{times} times\n\n" @@ -39,8 +39,8 @@ end json.close # YAML section -filename = 'benchmark/subjects/ohai.yml' -yaml = File.new(filename, 'r') +filename = "benchmark/subjects/ohai.yml" +yaml = File.new(filename, "r") puts "Starting benchmark parsing #{File.size(filename)} bytes of YAML data #{times} times\n\n" Benchmark.bmbm do |x| diff --git a/lib/ffi_yajl/benchmark/parse_profile.rb b/lib/ffi_yajl/benchmark/parse_profile.rb index 6ef00ac..4b396b4 100644 --- a/lib/ffi_yajl/benchmark/parse_profile.rb +++ b/lib/ffi_yajl/benchmark/parse_profile.rb @@ -1,15 +1,15 @@ # Portions Originally Copyright (c) 2008-2011 Brian Lopez - http://github.com/brianmario # See MIT-LICENSE -require 'rubygems' -require 'ffi_yajl' +require "rubygems" +require "ffi_yajl" begin - require 'perftools' + require "perftools" rescue LoadError puts "INFO: perftools.rb gem not installed" end -ENV['CPUPROFILE_FREQUENCY'] = "4000" +ENV["CPUPROFILE_FREQUENCY"] = "4000" module FFI_Yajl class Benchmark @@ -18,7 +18,7 @@ module FFI_Yajl return if defined?(PerfTools) filename = File.expand_path(File.join(File.dirname(__FILE__), "subjects", "ohai.json")) - json = File.new(filename, 'r').read + json = File.new(filename, "r").read times = 1000 puts "Starting profiling encoding #{filename} #{times} times\n\n" diff --git a/lib/ffi_yajl/benchmark/parse_profile_ruby_prof.rb b/lib/ffi_yajl/benchmark/parse_profile_ruby_prof.rb index 51696c5..2c4021a 100644 --- a/lib/ffi_yajl/benchmark/parse_profile_ruby_prof.rb +++ b/lib/ffi_yajl/benchmark/parse_profile_ruby_prof.rb @@ -1,15 +1,15 @@ # Portions Originally Copyright (c) 2008-2011 Brian Lopez - http://github.com/brianmario # See MIT-LICENSE -require 'rubygems' -require 'ffi_yajl' +require "rubygems" +require "ffi_yajl" module FFI_Yajl class Benchmark class ParseProfileRubyProf def run begin - require 'ruby-prof' + require "ruby-prof" rescue LoadError puts "INFO: perftools.rb gem not installed" end @@ -17,7 +17,7 @@ module FFI_Yajl return if defined?(RubyProf) filename = File.expand_path(File.join(File.dirname(__FILE__), "subjects", "ohai.json")) - json = File.new(filename, 'r').read + json = File.new(filename, "r").read times = 1000 puts "Starting profiling encoding #{filename} #{times} times\n\n" diff --git a/lib/ffi_yajl/benchmark/parse_stream.rb b/lib/ffi_yajl/benchmark/parse_stream.rb index 679eb92..9ca0050 100644 --- a/lib/ffi_yajl/benchmark/parse_stream.rb +++ b/lib/ffi_yajl/benchmark/parse_stream.rb @@ -1,20 +1,20 @@ -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/..') -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib') +$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + "/..") +$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + "/../lib") -require 'rubygems' -require 'benchmark' -require 'yajl' +require "rubygems" +require "benchmark" +require "yajl" begin - require 'json' + require "json" rescue LoadError end begin - require 'active_support' + require "active_support" rescue LoadError end -filename = 'benchmark/subjects/twitter_stream.json' -json = File.new(filename, 'r') +filename = "benchmark/subjects/twitter_stream.json" +json = File.new(filename, "r") times = ARGV[0] ? ARGV[0].to_i : 100 puts "Starting benchmark parsing JSON stream (#{File.size(filename)} bytes of JSON data with 430 JSON separate strings) #{times} times\n\n" -- cgit v1.2.1