Skip to content

Commit

Permalink
Merge pull request #98 from serihiro/fix-rubocop-warning
Browse files Browse the repository at this point in the history
Fix rubocop warning
  • Loading branch information
hxiong388 committed Jul 12, 2017
2 parents 37ed189 + 350de2e commit 4cece8b
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 19 deletions.
5 changes: 5 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
inherit_from: .rubocop_todo.yml

Metrics/BlockLength:
Exclude:
- 'spec/**/*.rb'
- 'googleauth.gemspec'
27 changes: 18 additions & 9 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -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'
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
sudo: false
language: ruby
rvm:
- 2.3
- 2.3.3
- 2.2
- 2.0.0
- 2.1
Expand Down
10 changes: 6 additions & 4 deletions lib/googleauth/user_authorizer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -267,10 +267,12 @@ def monitor_credentials(user_id, credentials)
# 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
Expand Down
6 changes: 3 additions & 3 deletions spec/googleauth/apply_auth_examples.rb
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,10 @@
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)
Expand Down
3 changes: 1 addition & 2 deletions spec/googleauth/stores/file_token_store_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 4cece8b

Please sign in to comment.