From 35bef8958803d3288e0823a5a9a50d58ee3ae4c5 Mon Sep 17 00:00:00 2001 From: Kazuhiro Serizawa Date: Sat, 25 Feb 2017 22:55:15 +0900 Subject: [PATCH 1/6] rubocop autocorrect: Favor a normal if-statement --- lib/googleauth/user_authorizer.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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 From a67e5297c29d0bbd8008bb69dca3e600f11be536 Mon Sep 17 00:00:00 2001 From: Kazuhiro Serizawa Date: Sat, 25 Feb 2017 22:55:40 +0900 Subject: [PATCH 2/6] rubocop autocorrect: Fix empty method definition --- spec/googleauth/stores/file_token_store_spec.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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 From 198e766bcdb96a6c69f69e5dadb8b9364b53d26a Mon Sep 17 00:00:00 2001 From: Kazuhiro Serizawa Date: Sat, 25 Feb 2017 23:05:21 +0900 Subject: [PATCH 3/6] Disable `Metrics/BlockLength` for spec files and gemspec --- .rubocop.yml | 5 +++++ 1 file changed, 5 insertions(+) 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' From 9fda76427a41074b6ac1e3cf70196ff99bd5eaa9 Mon Sep 17 00:00:00 2001 From: Kazuhiro Serizawa Date: Sat, 25 Feb 2017 23:15:17 +0900 Subject: [PATCH 4/6] Use normalcase for variable numbers. --- spec/googleauth/apply_auth_examples.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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) From bcca449f797710b827b36408cf93d122c378168a Mon Sep 17 00:00:00 2001 From: Kazuhiro Serizawa Date: Sat, 25 Feb 2017 23:19:09 +0900 Subject: [PATCH 5/6] rubocop --auto-gen-config --- .rubocop_todo.yml | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) 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' From 350de2ef6093b60811f7ac203346eac18374d881 Mon Sep 17 00:00:00 2001 From: Kazuhiro Serizawa Date: Sun, 26 Feb 2017 14:32:37 +0900 Subject: [PATCH 6/6] Specify ruby patch version for ruby2.3 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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