Skip to content

Commit

Permalink
chore(ci): update supported ruby versions in test matrix
Browse files Browse the repository at this point in the history
Upgrade rubocop to latest version < 1
  • Loading branch information
theodorton committed Sep 21, 2024
1 parent 2009e27 commit 0a9214e
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 19 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ jobs:
strategy:
matrix:
ruby-version:
- '2.6'
- '2.7'
- '3.0'
- '3.1'
- '3.2'
- '3.3'

steps:
- uses: actions/checkout@v4
Expand Down
7 changes: 5 additions & 2 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
Metrics/LineLength:
AllCops:
NewCops: disable

Layout/LineLength:
Max: 100

Metrics/BlockLength:
Exclude:
- 'spec/**/*_spec.rb'
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.5.5
3.0.7
4 changes: 3 additions & 1 deletion google_distance_matrix.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,16 @@ Gem::Specification.new do |spec|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ['lib']

spec.required_ruby_version = '>= 3.0'

spec.add_dependency 'activemodel', '>= 3.2.13', '< 7.2'
spec.add_dependency 'activesupport', '>= 3.2.13', '< 7.2'
spec.add_dependency 'google_business_api_url_signer', '~> 0.1.3'

spec.add_development_dependency 'bundler'
spec.add_development_dependency 'rake'
spec.add_development_dependency 'rspec', '~> 3.12.0'
spec.add_development_dependency 'rubocop', '~> 0.59.2'
spec.add_development_dependency 'rubocop', '~> 0.93.1'
spec.add_development_dependency 'shoulda-matchers', '~> 4.0.0.rc1'
spec.add_development_dependency 'webmock', '~> 3.4.2'
end
4 changes: 2 additions & 2 deletions lib/google_distance_matrix/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ def get(url, instrumentation: {}, **_options)
end

handle response, url
rescue Timeout::Error => error
raise ServerError, error
rescue Timeout::Error => e
raise ServerError, e
end

private
Expand Down
4 changes: 0 additions & 4 deletions lib/google_distance_matrix/place.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,6 @@ def assign_attributes(attributes)
@lng = attributes[:lng]
end

# rubocop:disable Metrics/AbcSize
# rubocop:disable Metrics/CyclomaticComplexity
# rubocop:disable Style/GuardClause
def validate_attributes
unless address.present? || (lat.present? && lng.present?)
Expand All @@ -107,8 +105,6 @@ def validate_attributes
raise ArgumentError, 'Cannot provide address, lat and lng.'
end
end
# rubocop:enable Metrics/AbcSize
# rubocop:enable Metrics/CyclomaticComplexity
# rubocop:enable Style/GuardClause
end
end
2 changes: 2 additions & 0 deletions lib/google_distance_matrix/polyline_encoder/value_encoder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class PolylineEncoder
class ValueEncoder
# rubocop:disable Metrics/MethodLength
# rubocop:disable Metrics/AbcSize
# rubocop:disable Metrics/CyclomaticComplexity
def encode(value)
negative = value < 0
value = value.abs
Expand Down Expand Up @@ -49,6 +50,7 @@ def encode(value)
# step 11: Convert to ASCII
chunks_of_5_bits.map(&:chr)
end
# rubocop:enable Metrics/CyclomaticComplexity
# rubocop:enable Metrics/MethodLength
# rubocop:enable Metrics/AbcSize

Expand Down
2 changes: 0 additions & 2 deletions lib/google_distance_matrix/url_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ def params
end

# rubocop:disable Metrics/MethodLength
# rubocop:disable Metrics/AbcSize
def places_to_param(places)
places_to_param_config = { lat_lng_scale: configuration.lat_lng_scale }

Expand All @@ -102,7 +101,6 @@ def places_to_param(places)
out.join(DELIMITER)
end
# rubocop:enable Metrics/MethodLength
# rubocop:enable Metrics/AbcSize

def protocol
configuration.protocol + '://'
Expand Down
4 changes: 2 additions & 2 deletions spec/lib/google_distance_matrix/client_cache_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

subject { described_class.new client, cache }

# rubocop:disable Metrics/LineLength
# rubocop:disable Layout/LineLength
describe '::key' do
it 'returns a digest of given URL' do
key = described_class.key 'some url with secret parts', config
Expand All @@ -29,7 +29,7 @@

expect(subject.get(url, options)).to eq 'cached-data'
end
# rubocop:enable Metrics/LineLength
# rubocop:enable Layout/LineLength

it 'asks client when cache miss' do
expect(client).to receive(:get).with(url, options).and_return 'api-data'
Expand Down
4 changes: 2 additions & 2 deletions spec/lib/google_distance_matrix/configuration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,12 @@
it { expect(subject.logger).to be_nil }
it { expect(subject.cache).to be_nil }

# rubocop:disable Metrics/LineLength
# rubocop:disable Layout/LineLength
it 'has a default expected cache_key_transform' do
key = subject.cache_key_transform.call('foo')
expect(key).to eq 'f7fbba6e0636f890e56fbbf3283e524c6fa3204ae298382d624741d0dc6638326e282c41be5e4254d8820772c5518a2c5a8c0c7f7eda19594a7eb539453e1ed7'
end
# rubocop:enable Metrics/LineLength
# rubocop:enable Layout/LineLength
end

describe '#to_param' do
Expand Down

0 comments on commit 0a9214e

Please sign in to comment.