Merge pull request #98 from serihiro/fix-rubocop-warning

Fix rubocop warning
This commit is contained in:
hxiong388 2017-07-12 15:52:59 -07:00 committed by GitHub
commit 4cece8bd80
6 changed files with 34 additions and 19 deletions

View File

@ -1 +1,6 @@
inherit_from: .rubocop_todo.yml inherit_from: .rubocop_todo.yml
Metrics/BlockLength:
Exclude:
- 'spec/**/*.rb'
- 'googleauth.gemspec'

View File

@ -1,32 +1,41 @@
# This configuration was generated by # This configuration was generated by
# `rubocop --auto-gen-config` # `rubocop --auto-gen-config`
# on 2015-10-14 13:50:41 -0700 using RuboCop version 0.34.2. # on 2017-02-25 23:23:21 +0900 using RuboCop version 0.46.0.
# The point is for the user to remove these configuration records # The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base. # one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new # Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again. # versions of RuboCop, may require this file to be generated again.
# Offense count: 4 # Offense count: 5
# Configuration parameters: Include.
# Include: **/Gemfile, **/gems.rb
Bundler/OrderedGems:
Exclude:
- 'Gemfile'
# Offense count: 3
Metrics/AbcSize: Metrics/AbcSize:
Max: 27 Max: 27
# Offense count: 1
# Configuration parameters: CountComments.
Metrics/ClassLength:
Max: 109
# Offense count: 1 # Offense count: 1
Metrics/CyclomaticComplexity: Metrics/CyclomaticComplexity:
Max: 7 Max: 7
# Offense count: 16 # Offense count: 18
# Configuration parameters: CountComments. # Configuration parameters: CountComments.
Metrics/MethodLength: Metrics/MethodLength:
Max: 22 Max: 22
# Offense count: 2 # Offense count: 3
# Configuration parameters: EnforcedStyle, SupportedStyles. # Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: format, sprintf, percent
Style/FormatString: Style/FormatString:
Exclude: Exclude:
- 'lib/googleauth/user_authorizer.rb' - 'lib/googleauth/user_authorizer.rb'
- 'lib/googleauth/web_user_authorizer.rb' - 'lib/googleauth/web_user_authorizer.rb'
# Offense count: 1
# Configuration parameters: MinBodyLength.
Style/GuardClause:
Exclude:
- 'lib/googleauth/web_user_authorizer.rb'

View File

@ -1,7 +1,7 @@
sudo: false sudo: false
language: ruby language: ruby
rvm: rvm:
- 2.3 - 2.3.3
- 2.2 - 2.2
- 2.0.0 - 2.0.0
- 2.1 - 2.1

View File

@ -267,10 +267,12 @@ module Google
# Redirect URI # Redirect URI
def redirect_uri_for(base_url) def redirect_uri_for(base_url)
return @callback_uri unless URI(@callback_uri).scheme.nil? return @callback_uri unless URI(@callback_uri).scheme.nil?
raise sprintf( if base_url.nil? || URI(base_url).scheme.nil?
MISSING_ABSOLUTE_URL_ERROR, raise sprintf(
@callback_uri MISSING_ABSOLUTE_URL_ERROR,
) if base_url.nil? || URI(base_url).scheme.nil? @callback_uri
)
end
URI.join(base_url, @callback_uri).to_s URI.join(base_url, @callback_uri).to_s
end end
end end

View File

@ -132,10 +132,10 @@ shared_examples 'apply/apply! are OK' do
end end
it 'should fetch a new token if the current one is expired' do it 'should fetch a new token if the current one is expired' do
token_1 = '1/abcdef1234567890' token1 = '1/abcdef1234567890'
token_2 = '2/abcdef1234567891' token2 = '2/abcdef1234567891'
[token_1, token_2].each do |t| [token1, token2].each do |t|
make_auth_stubs access_token: t make_auth_stubs access_token: t
md = { foo: 'bar' } md = { foo: 'bar' }
got = @client.apply(md) got = @client.apply(md)

View File

@ -42,8 +42,7 @@ module FakeFS
class File class File
# FakeFS doesn't implement. And since we don't need to actually lock, # FakeFS doesn't implement. And since we don't need to actually lock,
# just stub out... # just stub out...
def flock(*) def flock(*); end
end
end end
end end