Skip to content

Commit c10e392

Browse files
committed
Upgrade Rubocop to 1.45.
1 parent bae131f commit c10e392

File tree

10 files changed

+70
-50
lines changed

10 files changed

+70
-50
lines changed

Diff for: .github/workflows/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
- { ruby: '2.7', faraday: '0.9.0' }
1212
- { ruby: '2.7', faraday: '0.17.0' }
1313
- { ruby: '2.7', faraday: '~> 1.0' }
14-
- { ruby: 'jruby-9.2.21.0' }
14+
- { ruby: 'jruby-9.3' }
1515
- { ruby: 'ruby-head', allowed-failure: true }
1616
- { ruby: 'jruby-head', allowed-failure: true }
1717
name: test (${{ matrix.entry.ruby }}, ${{ matrix.entry.faraday || 'default' }})

Diff for: .rubocop.yml

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
inherit_from: .rubocop_todo.yml
22

3+
require:
4+
- rubocop-rake
5+
- rubocop-minitest
6+
37
AllCops:
8+
NewCops: enable
49
TargetRubyVersion: 2.3
510

611
Metrics:

Diff for: .rubocop_todo.yml

+33-29
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,51 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config`
3-
# on 2020-12-03 14:08:14 -0500 using RuboCop version 0.81.0.
3+
# on 2023-02-16 15:23:43 UTC using RuboCop version 1.45.1.
44
# The point is for the user to remove these configuration records
55
# one by one as the offenses are removed from the code base.
66
# Note that changes in the inspected code, or installation of new
77
# versions of RuboCop, may require this file to be generated again.
88

9+
# Offense count: 1
10+
# Configuration parameters: Severity, Include.
11+
# Include: **/*.gemspec
12+
Gemspec/RequiredRubyVersion:
13+
Exclude:
14+
- 'hyperclient.gemspec'
15+
16+
# Offense count: 1
17+
# Configuration parameters: AllowComments, AllowEmptyLambdas.
18+
Lint/EmptyBlock:
19+
Exclude:
20+
- 'test/hyperclient/entry_point_test.rb'
21+
22+
# Offense count: 4
23+
Lint/MissingSuper:
24+
Exclude:
25+
- 'lib/hyperclient/attributes.rb'
26+
- 'lib/hyperclient/entry_point.rb'
27+
- 'lib/hyperclient/link_collection.rb'
28+
- 'lib/hyperclient/resource_collection.rb'
29+
30+
# Offense count: 1
31+
# This cop supports unsafe autocorrection (--autocorrect-all).
32+
# Configuration parameters: AllowedMethods.
33+
# AllowedMethods: instance_of?, kind_of?, is_a?, eql?, respond_to?, equal?
34+
Lint/RedundantSafeNavigation:
35+
Exclude:
36+
- 'lib/hyperclient/link.rb'
37+
938
# Offense count: 2
10-
# Cop supports --auto-correct.
11-
# Configuration parameters: AutoCorrect, EnforcedStyle.
39+
# This cop supports unsafe autocorrection (--autocorrect-all).
40+
# Configuration parameters: EnforcedStyle.
1241
# SupportedStyles: nested, compact
1342
Style/ClassAndModuleChildren:
1443
Exclude:
1544
- 'features/steps/api_navigation.rb'
1645
- 'features/steps/default_config.rb'
1746

1847
# Offense count: 4
48+
# Configuration parameters: AllowedConstants.
1949
Style/Documentation:
2050
Exclude:
2151
- 'spec/**/*'
@@ -24,29 +54,3 @@ Style/Documentation:
2454
- 'features/steps/default_config.rb'
2555
- 'features/support/api.rb'
2656
- 'features/support/fixtures.rb'
27-
28-
# Offense count: 2
29-
Style/DoubleNegation:
30-
Exclude:
31-
- 'lib/hyperclient/curie.rb'
32-
- 'lib/hyperclient/link.rb'
33-
34-
# Offense count: 3
35-
# Cop supports --auto-correct.
36-
Style/IfUnlessModifier:
37-
Exclude:
38-
- 'lib/hyperclient/link_collection.rb'
39-
- 'lib/hyperclient/resource.rb'
40-
- 'lib/hyperclient/resource_collection.rb'
41-
42-
# Offense count: 1
43-
Style/MethodMissingSuper:
44-
Exclude:
45-
- 'lib/hyperclient/collection.rb'
46-
47-
# Offense count: 101
48-
# Cop supports --auto-correct.
49-
# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
50-
# URISchemes: http, https
51-
Layout/LineLength:
52-
Max: 147

Diff for: CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
* [#268](https://github.com/codegram/hyperclient/pull/268): Replace Travis-CI with GHA - [@dblock](https://github.com/dblock).
66
* [#269](https://github.com/codegram/hyperclient/pull/269): Re-add code coverage - [@dblock](https://github.com/dblock).
7+
* [#270](https://github.com/codegram/hyperclient/pull/270): Upgrade Rubocop to 1.45 - [@dblock](https://github.com/dblock).
78
* Your contribution here.
89

910
### 1.0.1 (2021/01/02)

Diff for: Gemfile

+3-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ end
1515

1616
group :development, :test do
1717
gem 'rake'
18-
gem 'rubocop', '0.81.0', require: false
18+
gem 'rubocop', '~> 1.45.1', require: false
19+
gem 'rubocop-minitest', require: false
20+
gem 'rubocop-rake', require: false
1921
gem 'simplecov', require: false
2022
gem 'simplecov-lcov', require: false
2123
end

Diff for: features/support/api.rb

+22-11
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,28 @@ module API
77
before do
88
WebMock::Config.instance.query_values_notation = :flat_array
99

10-
stub_request(:any, /api.example.org*/).to_return(body: root_response, headers: { 'Content-Type' => 'application/hal+json' })
11-
stub_request(:get, 'api.example.org').to_return(body: root_response, headers: { 'Content-Type' => 'application/hal+json' })
12-
stub_request(:get, 'api.example.org/authors').to_return(body: authors_response, headers: { 'Content-Type' => 'application/hal+json' })
13-
stub_request(:get, 'api.example.org/posts').to_return(body: posts_response, headers: { 'Content-Type' => 'application/hal+json' })
14-
stub_request(:get, 'api.example.org/posts?page=2').to_return(body: posts_page2_response, headers: { 'Content-Type' => 'application/hal+json' })
15-
stub_request(:get, 'api.example.org/posts?page=3').to_return(body: posts_page3_response, headers: { 'Content-Type' => 'application/hal+json' })
16-
stub_request(:get, 'api.example.org/posts/1').to_return(body: post1_response, headers: { 'Content-Type' => 'application/hal+json' })
17-
stub_request(:get, 'api.example.org/posts/2').to_return(body: post2_response, headers: { 'Content-Type' => 'application/hal+json' })
18-
stub_request(:get, 'api.example.org/posts/3').to_return(body: post3_response, headers: { 'Content-Type' => 'application/hal+json' })
19-
stub_request(:get, 'api.example.org/page2').to_return(body: page2_response, headers: { 'Content-Type' => 'application/hal+json' })
20-
stub_request(:get, 'api.example.org/page3').to_return(body: page3_response, headers: { 'Content-Type' => 'application/hal+json' })
10+
stub_request(:any, /api.example.org*/).to_return(body: root_response,
11+
headers: { 'Content-Type' => 'application/hal+json' })
12+
stub_request(:get, 'api.example.org').to_return(body: root_response,
13+
headers: { 'Content-Type' => 'application/hal+json' })
14+
stub_request(:get, 'api.example.org/authors').to_return(body: authors_response,
15+
headers: { 'Content-Type' => 'application/hal+json' })
16+
stub_request(:get, 'api.example.org/posts').to_return(body: posts_response,
17+
headers: { 'Content-Type' => 'application/hal+json' })
18+
stub_request(:get, 'api.example.org/posts?page=2').to_return(body: posts_page2_response,
19+
headers: { 'Content-Type' => 'application/hal+json' })
20+
stub_request(:get, 'api.example.org/posts?page=3').to_return(body: posts_page3_response,
21+
headers: { 'Content-Type' => 'application/hal+json' })
22+
stub_request(:get, 'api.example.org/posts/1').to_return(body: post1_response,
23+
headers: { 'Content-Type' => 'application/hal+json' })
24+
stub_request(:get, 'api.example.org/posts/2').to_return(body: post2_response,
25+
headers: { 'Content-Type' => 'application/hal+json' })
26+
stub_request(:get, 'api.example.org/posts/3').to_return(body: post3_response,
27+
headers: { 'Content-Type' => 'application/hal+json' })
28+
stub_request(:get, 'api.example.org/page2').to_return(body: page2_response,
29+
headers: { 'Content-Type' => 'application/hal+json' })
30+
stub_request(:get, 'api.example.org/page3').to_return(body: page3_response,
31+
headers: { 'Content-Type' => 'application/hal+json' })
2132
end
2233

2334
def api

Diff for: hyperclient.gemspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ Gem::Specification.new do |gem|
88
gem.homepage = 'https://github.com/codegram/hyperclient/'
99
gem.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
1010
gem.files = `git ls-files`.split("\n")
11-
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
1211
gem.name = 'hyperclient'
1312
gem.require_paths = ['lib']
1413
gem.version = Hyperclient::VERSION
@@ -17,4 +16,5 @@ Gem::Specification.new do |gem|
1716
gem.add_dependency 'faraday', '>= 0.9.0'
1817
gem.add_dependency 'faraday_hal_middleware'
1918
gem.add_dependency 'faraday_middleware'
19+
gem.metadata['rubygems_mfa_required'] = 'true'
2020
end

Diff for: lib/hyperclient/resource.rb

+1-3
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,7 @@ def method_missing(method, *args, &block)
111111
elsif !Array.method_defined?(method)
112112
%i[_attributes _embedded _links].each do |target|
113113
target = send(target)
114-
if target.respond_to?(method.to_s)
115-
return target.send(method, *args, &block)
116-
end
114+
return target.send(method, *args, &block) if target.respond_to?(method.to_s)
117115
end
118116
super
119117
end

Diff for: lib/hyperclient/resource_collection.rb

+1-3
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ def initialize(collection, entry_point)
2323
private
2424

2525
def build_resource(representation)
26-
if representation.is_a?(Array)
27-
return representation.map(&method(:build_resource))
28-
end
26+
return representation.map(&method(:build_resource)) if representation.is_a?(Array)
2927

3028
Resource.new(representation, @entry_point)
3129
end

Diff for: test/hyperclient/resource_test.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ module Hyperclient
6060

6161
describe '_links' do
6262
it '_expand' do
63-
resource = Resource.new({ '_links' => { 'orders' => { 'href' => '/orders/{id}', 'templated' => true } } }, entry_point)
63+
resource = Resource.new({ '_links' => { 'orders' => { 'href' => '/orders/{id}', 'templated' => true } } },
64+
entry_point)
6465
_(resource._links.orders._expand(id: 1)._url).must_equal '/orders/1'
6566
_(resource.orders._expand(id: 1)._url).must_equal '/orders/1'
6667
_(resource.orders(id: 1)._url).must_equal '/orders/1'

0 commit comments

Comments
 (0)