diff --git a/.rubocop.yml b/.rubocop.yml index 8fede7b..019c78d 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -17,3 +17,10 @@ Style/IndentHeredoc: Enabled: false Style/FormatString: Enabled: false +Style/GuardClause: + Enabled: false +Style/PercentLiteralDelimiters: # Contradicting rule + Enabled: false +Style/SymbolArray: # Undefined syntax in Ruby 1.9.3 + Enabled: false + diff --git a/Rakefile b/Rakefile index c4d4ffc..2c95e80 100755 --- a/Rakefile +++ b/Rakefile @@ -10,6 +10,6 @@ desc 'Run rake task' RSpec::Core::RakeTask.new(:spec) desc 'Does rubocop lint and runs the specs' -task all: %i[rubocop spec] +task all: [:rubocop, :spec] task default: :all diff --git a/lib/googleauth/user_refresh.rb b/lib/googleauth/user_refresh.rb index 4abe7a3..14c1990 100644 --- a/lib/googleauth/user_refresh.rb +++ b/lib/googleauth/user_refresh.rb @@ -75,7 +75,7 @@ module Google # JSON key. def self.read_json_key(json_key_io) json_key = MultiJson.load(json_key_io.read) - wanted = %w[client_id client_secret refresh_token] + wanted = %w(client_id client_secret refresh_token) wanted.each do |key| raise "the json is missing the #{key} field" unless json_key.key?(key) end diff --git a/lib/googleauth/web_user_authorizer.rb b/lib/googleauth/web_user_authorizer.rb index 9b09d06..cfe8eac 100644 --- a/lib/googleauth/web_user_authorizer.rb +++ b/lib/googleauth/web_user_authorizer.rb @@ -227,7 +227,7 @@ module Google # @param [Rack::Request] request # Current request def self.validate_callback_state(state, request) - if state[AUTH_CODE_KEY].nil? # rubocop:disable Style/GuardClause + if state[AUTH_CODE_KEY].nil? raise Signet::AuthorizationError, MISSING_AUTH_CODE_ERROR elsif state[ERROR_CODE_KEY] raise Signet::AuthorizationError, diff --git a/spec/googleauth/scope_util_spec.rb b/spec/googleauth/scope_util_spec.rb index f401b9e..d69b820 100644 --- a/spec/googleauth/scope_util_spec.rb +++ b/spec/googleauth/scope_util_spec.rb @@ -70,7 +70,7 @@ describe Google::Auth::ScopeUtil do context 'with scope as Array' do let(:source) do - %w[email profile openid https://www.googleapis.com/auth/drive] + %w(email profile openid https://www.googleapis.com/auth/drive) end it_behaves_like 'normalizes scopes' end diff --git a/spec/googleauth/user_authorizer_spec.rb b/spec/googleauth/user_authorizer_spec.rb index d0bcfe2..5e8d62e 100644 --- a/spec/googleauth/user_authorizer_spec.rb +++ b/spec/googleauth/user_authorizer_spec.rb @@ -41,7 +41,7 @@ describe Google::Auth::UserAuthorizer do include TestHelpers let(:client_id) { Google::Auth::ClientId.new('testclient', 'notasecret') } - let(:scope) { %w[email profile] } + let(:scope) { %w(email profile) } let(:token_store) { DummyTokenStore.new } let(:callback_uri) { 'https://www.example.com/oauth/callback' } let(:authorizer) do @@ -173,7 +173,7 @@ describe Google::Auth::UserAuthorizer do end it 'should return credentials with a valid scope' do - expect(credentials.scope).to eq %w[email profile] + expect(credentials.scope).to eq %w(email profile) end it 'should return credentials with a valid expiration time' do diff --git a/spec/googleauth/user_refresh_spec.rb b/spec/googleauth/user_refresh_spec.rb index a2bb059..d80f6ba 100644 --- a/spec/googleauth/user_refresh_spec.rb +++ b/spec/googleauth/user_refresh_spec.rb @@ -115,7 +115,7 @@ describe Google::Auth::UserRefreshCredentials do end it 'fails if the GOOGLE_APPLICATION_CREDENTIALS path file is invalid' do - needed = %w[client_id client_secret refresh_token] + needed = %w(client_id client_secret refresh_token) needed.each do |missing| Dir.mktmpdir do |dir| key_path = File.join(dir, 'my_cert_file') @@ -169,7 +169,7 @@ describe Google::Auth::UserRefreshCredentials do end it 'fails if the file is invalid' do - needed = %w[client_id client_secret refresh_token] + needed = %w(client_id client_secret refresh_token) needed.each do |missing| Dir.mktmpdir do |dir| key_path = File.join(dir, '.config', @known_path) @@ -208,7 +208,7 @@ describe Google::Auth::UserRefreshCredentials do end it 'fails if the file is invalid' do - needed = %w[client_id client_secret refresh_token] + needed = %w(client_id client_secret refresh_token) needed.each do |missing| FakeFS do FileUtils.mkdir_p(File.dirname(@path)) diff --git a/spec/googleauth/web_user_authorizer_spec.rb b/spec/googleauth/web_user_authorizer_spec.rb index 939bb3f..04e30dd 100644 --- a/spec/googleauth/web_user_authorizer_spec.rb +++ b/spec/googleauth/web_user_authorizer_spec.rb @@ -42,7 +42,7 @@ describe Google::Auth::WebUserAuthorizer do include TestHelpers let(:client_id) { Google::Auth::ClientId.new('testclient', 'notasecret') } - let(:scope) { %w[email profile] } + let(:scope) { %w(email profile) } let(:token_store) { DummyTokenStore.new } let(:authorizer) do Google::Auth::WebUserAuthorizer.new(client_id, scope, token_store)