Skip to content

Commit

Permalink
Bump up rubocop dependency version to v0.22.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ixti committed May 25, 2014
1 parent 23a77b7 commit 1eedcdd
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 23 deletions.
17 changes: 16 additions & 1 deletion .rubocop.yml
@@ -1,5 +1,5 @@
AllCops:
Includes:
Include:
- 'Gemfile'
- 'Rakefile'
- 'http.gemspec'
Expand Down Expand Up @@ -99,3 +99,18 @@ PercentLiteralDelimiters:
Semicolon:
Exclude:
- 'spec/support/'

# Do not force first argument to be separated with exactly single space.
# My (ixti) personal preference is to align code in columns when it makes
# sense:
#
# module HTTP
# module MimeType
# class JSON < Adapter
# register_adapter 'application/json', JSON
# register_alias 'application/json', :json
# end
# end
# end
SingleSpaceBeforeFirstArg:
Enabled: false
2 changes: 1 addition & 1 deletion Gemfile
Expand Up @@ -21,7 +21,7 @@ group :test do
gem 'json', '>= 1.8.1', :platforms => [:jruby, :rbx, :ruby_18, :ruby_19]
gem 'mime-types', '~> 1.25', :platforms => [:jruby, :ruby_18]
gem 'rspec', '>= 2.14'
gem 'rubocop', '~> 0.19.0', :platforms => [:ruby_19, :ruby_20, :ruby_21]
gem 'rubocop', '~> 0.22.0', :platforms => [:ruby_19, :ruby_20, :ruby_21]
gem 'simplecov', :require => false
gem 'yardstick'
end
Expand Down
8 changes: 4 additions & 4 deletions lib/http/backports/uri.rb
Expand Up @@ -81,11 +81,11 @@ def self.encode_www_form(enum)
encode_www_form_component(k)
elsif v.respond_to?(:to_ary)
v.to_ary.map do |w|
next unless w

str = encode_www_form_component(k)
unless w.nil?
str << '='
str << encode_www_form_component(w)
end
str << '='
str << encode_www_form_component(w)
end.join('&')
else
str = encode_www_form_component(k)
Expand Down
2 changes: 1 addition & 1 deletion lib/http/request.rb
Expand Up @@ -48,7 +48,7 @@ class UnsupportedSchemeError < RequestError; end

# The following method may be removed in two minor versions (0.7.0) or one
# major version (1.0.0)
def method(*args)
def method(*)
warn "#{Kernel.caller.first}: [DEPRECATION] HTTP::Request#method is deprecated. Use #verb instead. For Object#method, use #__method__."
@verb
end
Expand Down
6 changes: 2 additions & 4 deletions lib/http/response/parser.rb
Expand Up @@ -42,10 +42,8 @@ def on_body(chunk)
end

def chunk
if (chunk = @chunk)
@chunk = nil
chunk
end
chunk, @chunk = @chunk, nil
chunk
end

def on_message_complete
Expand Down
2 changes: 1 addition & 1 deletion spec/http/client_spec.rb
Expand Up @@ -133,7 +133,7 @@ def simple_response(body, status = 200)
let(:client) { described_class.new :headers => headers }

it 'keeps `Host` header as is' do
expect(client).to receive(:perform) do |req, options|
expect(client).to receive(:perform) do |req, _|
expect(req['Host']).to eq 'another.example.com'
end

Expand Down
17 changes: 9 additions & 8 deletions spec/support/example_server.rb
Expand Up @@ -41,18 +41,19 @@ def handle_root(request, response)
end

def handle_params(request, response)
if request.query_string == 'foo=bar'
response.status = 200
response.body = 'Params!'
end
return unless request.query_string == 'foo=bar'

response.status = 200
response.body = 'Params!'
end

def handle_multiple_params(request, response)
params = CGI.parse(request.query_string)
if params == {'foo' => ['bar'], 'baz' => ['quux']}
response.status = 200
response.body = 'More Params!'
end

return unless params == {'foo' => ['bar'], 'baz' => ['quux']}

response.status = 200
response.body = 'More Params!'
end

def do_POST(request, response) # rubocop:disable MethodName
Expand Down
4 changes: 1 addition & 3 deletions spec/support/proxy_server.rb
@@ -1,8 +1,6 @@
require 'webrick/httpproxy'

handler = proc do | req, res |
res['X-PROXIED'] = true
end
handler = proc { |_, res| res['X-PROXIED'] = true }

ProxyServer = WEBrick::HTTPProxyServer.new(
:Port => 8080,
Expand Down

0 comments on commit 1eedcdd

Please sign in to comment.