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
Metrics/BlockLength:
Exclude:
- 'spec/**/*.rb'
- 'googleauth.gemspec'

View File

@ -1,32 +1,41 @@
# This configuration was generated by
# `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
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# 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:
Max: 27
# Offense count: 1
# Configuration parameters: CountComments.
Metrics/ClassLength:
Max: 109
# Offense count: 1
Metrics/CyclomaticComplexity:
Max: 7
# Offense count: 16
# Offense count: 18
# Configuration parameters: CountComments.
Metrics/MethodLength:
Max: 22
# Offense count: 2
# Offense count: 3
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: format, sprintf, percent
Style/FormatString:
Exclude:
- 'lib/googleauth/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
language: ruby
rvm:
- 2.3
- 2.3.3
- 2.2
- 2.0.0
- 2.1

View File

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

View File

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

View File

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