diff --git a/.rubocop.yml b/.rubocop.yml index cc32da4..0ebe5d0 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1 +1,6 @@ inherit_from: .rubocop_todo.yml + +Metrics/BlockLength: + Exclude: + - 'spec/**/*.rb' + - 'googleauth.gemspec' diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 834f1f9..5440c1f 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -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' diff --git a/.travis.yml b/.travis.yml index f883d4e..7ae7a34 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ sudo: false language: ruby rvm: - - 2.3 + - 2.3.3 - 2.2 - 2.0.0 - 2.1 diff --git a/lib/googleauth/user_authorizer.rb b/lib/googleauth/user_authorizer.rb index b913dad..68fea74 100644 --- a/lib/googleauth/user_authorizer.rb +++ b/lib/googleauth/user_authorizer.rb @@ -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 diff --git a/spec/googleauth/apply_auth_examples.rb b/spec/googleauth/apply_auth_examples.rb index 9ee5cf3..d38f9ad 100644 --- a/spec/googleauth/apply_auth_examples.rb +++ b/spec/googleauth/apply_auth_examples.rb @@ -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) diff --git a/spec/googleauth/stores/file_token_store_spec.rb b/spec/googleauth/stores/file_token_store_spec.rb index 7936682..4ddca25 100644 --- a/spec/googleauth/stores/file_token_store_spec.rb +++ b/spec/googleauth/stores/file_token_store_spec.rb @@ -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