Update rubocop dependency to >= 0.25

This commit is contained in:
Erik Michaels-Ober 2014-08-18 13:21:39 +02:00
parent 04333b765b
commit aa89cf529f
10 changed files with 54 additions and 83 deletions

View File

@ -1,81 +1,57 @@
AllCops:
Include:
- 'Gemfile'
- 'Rakefile'
- 'omniauth.gemspec'
Lint/HandleExceptions:
Enabled: false
# Avoid long parameter lists
ParameterLists:
Max: 4
CountKeywordArgs: true
Metrics/BlockNesting:
Max: 2
MethodLength:
Metrics/LineLength:
AllowURI: true
Enabled: false
Metrics/MethodLength:
CountComments: false
Max: 15
# Avoid more than `Max` levels of nesting.
BlockNesting:
Max: 2
Metrics/ParameterLists:
Max: 4
CountKeywordArgs: true
# Align with the style guide.
CollectionMethods:
Style/AccessModifierIndentation:
EnforcedStyle: outdent
Style/CollectionMethods:
PreferredMethods:
map: 'collect'
reduce: 'inject'
find: 'detect'
find_all: 'select'
# Limit line length
LineLength:
Style/Documentation:
Enabled: false
# Disable documentation checking until a class needs to be documented once
Documentation:
Style/DotPosition:
EnforcedStyle: trailing
Style/DoubleNegation:
Enabled: false
# Enforce Ruby 1.8-compatible hash syntax
HashSyntax:
Style/EachWithObject:
Enabled: false
Style/Encoding:
Enabled: false
Style/HashSyntax:
EnforcedStyle: hash_rockets
# No spaces inside hash literals
SpaceInsideHashLiteralBraces:
EnforcedStyle: no_space
# Allow dots at the end of lines
DotPosition:
Style/Lambda:
Enabled: false
# Don't require magic comment at the top of every file
Encoding:
Enabled: false
# Enforce outdenting of access modifiers (i.e. public, private, protected)
AccessModifierIndentation:
EnforcedStyle: outdent
EmptyLinesAroundAccessModifier:
Enabled: true
# Align ends correctly
EndAlignment:
AlignWith: variable
# Indentation of when/else
CaseIndentation:
IndentWhenRelativeTo: end
IndentOneStep: false
Lambda:
Enabled: false
HandleExceptions:
Enabled: false
RaiseArgs:
Style/RaiseArgs:
EnforcedStyle: compact
TrailingComma:
Enabled: false
Style/SpaceInsideHashLiteralBraces:
EnforcedStyle: no_space
EachWithObject:
Enabled: false
Style/TrailingComma:
EnforcedStyleForMultiline: 'comma'

View File

@ -8,7 +8,6 @@ gemfile:
language: ruby
rvm:
- 1.8.7
- 1.9.2
- 1.9.3
- 2.0.0
- 2.1

View File

@ -26,7 +26,7 @@ group :test do
gem 'rack-test'
gem 'rest-client', '~> 1.6.0', :platforms => [:jruby, :ruby_18]
gem 'rspec', '~> 3.0'
gem 'rubocop', '>= 0.23', :platforms => [:ruby_19, :ruby_20, :ruby_21]
gem 'rubocop', '>= 0.25', :platforms => [:ruby_19, :ruby_20, :ruby_21]
gem 'simplecov', '>= 0.9'
end

View File

@ -1,7 +1,7 @@
guard 'rspec', :version => 2 do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { "spec/" }
watch(/^spec\/.+_spec\.rb$/)
watch(/^lib\/(.+)\.rb$/) { |m| "spec/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { 'spec/' }
end
guard 'bundler' do

View File

@ -143,7 +143,7 @@ your first stop if you are wondering about a more in-depth look at
OmniAuth, how it works, and how to use it.
## Supported Ruby Versions
OmniAuth is tested under 1.8.7, 1.9.2, 1.9.3, 2.0.0, 2.1.0, JRuby, and Rubinius.
OmniAuth is tested under 1.8.7, 1.9.3, 2.0.0, 2.1.0, JRuby, and Rubinius.
## Versioning
This library aims to adhere to [Semantic Versioning 2.0.0][semver]. Violations

View File

@ -42,7 +42,7 @@ module OmniAuth
:test_mode => false,
:logger => default_logger,
:allowed_request_methods => [:get, :post],
:mock_auth => {:default => AuthHash.new('provider' => 'default', 'uid' => '1234', 'info' => {'name' => 'Example User'})}
:mock_auth => {:default => AuthHash.new('provider' => 'default', 'uid' => '1234', 'info' => {'name' => 'Example User'})},
}
end

View File

@ -169,7 +169,7 @@ module OmniAuth
# the request path is recognized.
#
# @param env [Hash] The Rack environment.
def call!(env) # rubocop:disable CyclomaticComplexity
def call!(env) # rubocop:disable CyclomaticComplexity, PerceivedComplexity
unless env['rack.session']
error = OmniAuth::NoSessionError.new('You must provide a session to use OmniAuth.')
fail(error)
@ -194,7 +194,7 @@ module OmniAuth
end
# Performs the steps necessary to run the request phase of a strategy.
def request_call # rubocop:disable CyclomaticComplexity, MethodLength
def request_call # rubocop:disable CyclomaticComplexity, MethodLength, PerceivedComplexity
setup_phase
log :info, 'Request phase initiated.'
# store query params from the request url, extracted in the callback_phase

View File

@ -33,15 +33,13 @@ describe OmniAuth::AuthHash do
describe '#name' do
subject do
OmniAuth::AuthHash.new(
:info => {
:name => 'Phillip J. Fry',
:first_name => 'Phillip',
:last_name => 'Fry',
:nickname => 'meatbag',
:email => 'fry@planetexpress.com',
}
)
OmniAuth::AuthHash.new(:info => {
:name => 'Phillip J. Fry',
:first_name => 'Phillip',
:last_name => 'Fry',
:nickname => 'meatbag',
:email => 'fry@planetexpress.com',
})
end
it 'defaults to the name key' do

View File

@ -5,7 +5,7 @@ def make_env(path = '/auth/test', props = {})
'REQUEST_METHOD' => 'GET',
'PATH_INFO' => path,
'rack.session' => {},
'rack.input' => StringIO.new('test=true')
'rack.input' => StringIO.new('test=true'),
}.merge(props)
end
@ -331,7 +331,7 @@ describe OmniAuth::Strategy do
it 'is turned into an env variable on the callback phase, containing full path' do
env = {
'rack.session' => {'omniauth.origin' => 'http://example.com/sub_uri/origin'},
'SCRIPT_NAME' => '/sub_uri'
'SCRIPT_NAME' => '/sub_uri',
}
expect { strategy.call(make_env('/auth/test/callback', env)) }.to raise_error('Callback Phase')
@ -424,9 +424,7 @@ describe OmniAuth::Strategy do
end
it 'correctly reports the callback path when the custom callback path evaluator is truthy' do
strategy_instance = ExampleStrategy.new(app,
:callback_path => lambda { |env| env['PATH_INFO'] == '/auth/bish/bosh/callback' }
)
strategy_instance = ExampleStrategy.new(app, :callback_path => lambda { |env| env['PATH_INFO'] == '/auth/bish/bosh/callback' })
expect { strategy_instance.call(make_env('/auth/bish/bosh/callback')) }.to raise_error('Callback Phase')
expect(strategy_instance.callback_path).to eq('/auth/bish/bosh/callback')
@ -610,7 +608,7 @@ describe OmniAuth::Strategy do
it 'responds with a provider-specific hash if one is set' do
OmniAuth.config.mock_auth[:test] = {
'uid' => 'abc'
'uid' => 'abc',
}
strategy.call make_env('/auth/test/callback')

View File

@ -132,7 +132,7 @@ describe OmniAuth do
'some_word' => 'SomeWord',
'AnotherWord' => 'AnotherWord',
'one' => 'One',
'three_words_now' => 'ThreeWordsNow'
'three_words_now' => 'ThreeWordsNow',
}.each_pair { |k, v| expect(OmniAuth::Utils.camelize(k)).to eq(v) }
end