diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2015-07-09 13:46:23 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2015-07-09 13:46:23 -0700 |
commit | 457842ff8567742d94cb079f439c38403a15d8b8 (patch) | |
tree | 6171bb06b54874f297d24a3870a72052405dbde9 | |
parent | 79921599e7ba0f150f4cd093d626eea49831d8dc (diff) | |
download | ffi-yajl-457842ff8567742d94cb079f439c38403a15d8b8.tar.gz |
some more cop fixes
-rw-r--r-- | .rubocop.yml | 5 | ||||
-rw-r--r-- | lib/ffi_yajl/benchmark/encode.rb | 10 | ||||
-rw-r--r-- | lib/ffi_yajl/benchmark/encode_profile.rb | 2 | ||||
-rw-r--r-- | lib/ffi_yajl/benchmark/parse_profile.rb | 2 | ||||
-rw-r--r-- | lib/ffi_yajl/benchmark/parse_profile_ruby_prof.rb | 2 | ||||
-rw-r--r-- | lib/ffi_yajl/ffi/parser.rb | 4 | ||||
-rw-r--r-- | spec/spec_helper.rb | 14 |
7 files changed, 22 insertions, 17 deletions
diff --git a/.rubocop.yml b/.rubocop.yml index 170fc40..ad55721 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -18,6 +18,9 @@ Encoding: Enabled: false Eval: Enabled: false +Style/FileName: + Exclude: + - bin/ffi-yajl-bench FormatString: Enabled: false HashSyntax: @@ -40,6 +43,8 @@ PercentLiteralDelimiters: '%x': '{}' RegexpLiteral: Enabled: false +Style/Semicolon: + Enabled: false SignalException: Enabled: false SingleSpaceBeforeFirstArg: diff --git a/lib/ffi_yajl/benchmark/encode.rb b/lib/ffi_yajl/benchmark/encode.rb index 0a33a53..8e5c83f 100644 --- a/lib/ffi_yajl/benchmark/encode.rb +++ b/lib/ffi_yajl/benchmark/encode.rb @@ -48,21 +48,21 @@ module FFI_Yajl ::Benchmark.bmbm { |x| x.report("FFI_Yajl::Encoder.encode (to a String)") { times.times { - output = FFI_Yajl::Encoder.encode(hash) + FFI_Yajl::Encoder.encode(hash) } } ffi_string_encoder = FFI_Yajl::Encoder.new x.report("FFI_Yajl::Encoder#encode (to a String)") { times.times { - output = ffi_string_encoder.encode(hash) + ffi_string_encoder.encode(hash) } } if defined?(Oj) x.report("Oj.dump (to a String)") { times.times { - output = Oj.dump(hash) + Oj.dump(hash) } } end @@ -70,7 +70,7 @@ module FFI_Yajl if defined?(Yajl::Encoder) x.report("Yajl::Encoder.encode (to a String)") { times.times { - output = Yajl::Encoder.encode(hash) + Yajl::Encoder.encode(hash) } } @@ -84,7 +84,7 @@ module FFI_Yajl string_encoder = Yajl::Encoder.new x.report("Yajl::Encoder#encode (to a String)") { times.times { - output = string_encoder.encode(hash) + string_encoder.encode(hash) } } end diff --git a/lib/ffi_yajl/benchmark/encode_profile.rb b/lib/ffi_yajl/benchmark/encode_profile.rb index d993581..6158508 100644 --- a/lib/ffi_yajl/benchmark/encode_profile.rb +++ b/lib/ffi_yajl/benchmark/encode_profile.rb @@ -25,7 +25,7 @@ module FFI_Yajl ffi_string_encoder = FFI_Yajl::Encoder.new PerfTools::CpuProfiler.start("/tmp/ffi_yajl_encode_profile.out") do times.times { - output = ffi_string_encoder.encode(hash) + ffi_string_encoder.encode(hash) } end system("pprof.rb --text /tmp/ffi_yajl_encode_profile.out") diff --git a/lib/ffi_yajl/benchmark/parse_profile.rb b/lib/ffi_yajl/benchmark/parse_profile.rb index dfcbc01..9e53729 100644 --- a/lib/ffi_yajl/benchmark/parse_profile.rb +++ b/lib/ffi_yajl/benchmark/parse_profile.rb @@ -24,7 +24,7 @@ module FFI_Yajl PerfTools::CpuProfiler.start("/tmp/ffi_yajl_encode_profile.out") do times.times { - output = FFI_Yajl::Parser.parse(json) + FFI_Yajl::Parser.parse(json) } end system("pprof.rb --text /tmp/ffi_yajl_encode_profile.out") diff --git a/lib/ffi_yajl/benchmark/parse_profile_ruby_prof.rb b/lib/ffi_yajl/benchmark/parse_profile_ruby_prof.rb index db72e45..f71a756 100644 --- a/lib/ffi_yajl/benchmark/parse_profile_ruby_prof.rb +++ b/lib/ffi_yajl/benchmark/parse_profile_ruby_prof.rb @@ -23,7 +23,7 @@ module FFI_Yajl result = RubyProf.profile do times.times { - output = FFI_Yajl::Parser.parse(json) + FFI_Yajl::Parser.parse(json) } end diff --git a/lib/ffi_yajl/ffi/parser.rb b/lib/ffi_yajl/ffi/parser.rb index e3226c0..598fecf 100644 --- a/lib/ffi_yajl/ffi/parser.rb +++ b/lib/ffi_yajl/ffi/parser.rb @@ -143,12 +143,12 @@ module FFI_Yajl ::FFI_Yajl.yajl_config(yajl_handle, :yajl_allow_partial_values, :int, 1) end - if ( stat = ::FFI_Yajl.yajl_parse(yajl_handle, str, str.bytesize) != :yajl_status_ok ) + if ( ::FFI_Yajl.yajl_parse(yajl_handle, str, str.bytesize) != :yajl_status_ok ) # FIXME: dup the error and call yajl_free_error? error = ::FFI_Yajl.yajl_get_error(yajl_handle, 1, str, str.bytesize) raise ::FFI_Yajl::ParseError.new(error) end - if ( stat = FFI_Yajl.yajl_complete_parse(yajl_handle) != :yajl_status_ok ) + if ( ::FFI_Yajl.yajl_complete_parse(yajl_handle) != :yajl_status_ok ) # FIXME: dup the error and call yajl_free_error? error = ::FFI_Yajl.yajl_get_error(yajl_handle, 1, str, str.bytesize) raise ::FFI_Yajl::ParseError.new(error) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 147e124..17dabcd 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -28,18 +28,18 @@ $LOAD_PATH << File.expand_path(File.join(File.dirname( __FILE__ ), "../lib")) begin require 'yajl' rescue LoadError - # yajl can't be installed on jruby + puts 'WARN: yajl cannot be loaded, expected if this is jruby' end require 'ffi_yajl' -RSpec.configure do |c| - c.filter_run_excluding :unix_only => true unless RUBY_PLATFORM !~ /mswin|mingw|windows/ - c.filter_run_excluding :ruby_gte_193 => true unless RUBY_VERSION.to_f >= 2.0 || RUBY_VERSION =~ /^1\.9\.3/ +RSpec.configure do |conf| + conf.filter_run_excluding :unix_only => true unless RUBY_PLATFORM !~ /mswin|mingw|windows/ + conf.filter_run_excluding :ruby_gte_193 => true unless RUBY_VERSION.to_f >= 2.0 || RUBY_VERSION =~ /^1\.9\.3/ - c.order = 'random' + conf.order = 'random' - c.expect_with :rspec do |c| - c.syntax = :expect + conf.expect_with :rspec do |rspec| + rspec.syntax = :expect end end |