Skip to content

Commit cdc3a4e

Browse files
committed
Upgrade rubocop
1 parent d7ed357 commit cdc3a4e

File tree

9 files changed

+28
-39
lines changed

9 files changed

+28
-39
lines changed

.rubocop.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require:
1+
plugins:
22
- rubocop-performance
33
- rubocop-rake
44
- rubocop-rspec

.rubocop_todo.yml

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config --auto-gen-only-exclude --exclude-limit 100`
3-
# on 2024-01-05 21:03:44 UTC using RuboCop version 1.57.2.
3+
# on 2025-06-09 03:21:47 UTC using RuboCop version 1.76.0.
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
@@ -30,6 +30,15 @@ Layout/DotPosition:
3030
- 'spec/lib/http_spec.rb'
3131
- 'spec/support/http_handling_shared.rb'
3232

33+
# Offense count: 3
34+
# This cop supports safe autocorrection (--autocorrect).
35+
# Configuration parameters: Max, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings.
36+
# URISchemes: http, https
37+
Layout/LineLength:
38+
Exclude:
39+
- 'lib/http/chainable.rb'
40+
- 'spec/lib/http/options/proxy_spec.rb'
41+
3342
# Offense count: 206
3443
# This cop supports safe autocorrection (--autocorrect).
3544
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
@@ -143,7 +152,7 @@ RSpec/AnyInstance:
143152
Exclude:
144153
- 'spec/lib/http/client_spec.rb'
145154

146-
# Offense count: 4
155+
# Offense count: 3
147156
# This cop supports unsafe autocorrection (--autocorrect-all).
148157
RSpec/BeEq:
149158
Exclude:
@@ -189,7 +198,7 @@ RSpec/DescribeMethod:
189198

190199
# Offense count: 136
191200
# This cop supports unsafe autocorrection (--autocorrect-all).
192-
# Configuration parameters: SkipBlocks, EnforcedStyle.
201+
# Configuration parameters: SkipBlocks, EnforcedStyle, OnlyStaticConstants.
193202
# SupportedStyles: described_class, explicit
194203
RSpec/DescribedClass:
195204
Exclude:
@@ -242,13 +251,6 @@ RSpec/ExpectInHook:
242251
- 'spec/lib/http/connection_spec.rb'
243252
- 'spec/lib/http/request/writer_spec.rb'
244253

245-
# Offense count: 1
246-
# Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly.
247-
# Include: **/*_spec*rb*, **/spec/**/*
248-
RSpec/FilePath:
249-
Exclude:
250-
- 'spec/regression_specs.rb'
251-
252254
# Offense count: 6
253255
# Configuration parameters: Max, AllowedIdentifiers, AllowedPatterns.
254256
RSpec/IndexedLet:
@@ -417,12 +419,3 @@ Style/OptionalBooleanParameter:
417419
Style/ZeroLengthPredicate:
418420
Exclude:
419421
- 'lib/http/features/auto_deflate.rb'
420-
421-
# Offense count: 3
422-
# This cop supports safe autocorrection (--autocorrect).
423-
# Configuration parameters: Max, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
424-
# URISchemes: http, https
425-
Layout/LineLength:
426-
Exclude:
427-
- 'lib/http/chainable.rb'
428-
- 'spec/lib/http/options/proxy_spec.rb'

Gemfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ group :test do
2727

2828
gem "backports"
2929

30-
gem "rubocop", "~> 1.61.0"
31-
gem "rubocop-performance", "~> 1.19.1"
32-
gem "rubocop-rake", "~> 0.6.0"
33-
gem "rubocop-rspec", "~> 2.24.1"
30+
gem "rubocop", "~> 1.76.0"
31+
gem "rubocop-performance", "~> 1.25.0"
32+
gem "rubocop-rake", "~> 0.7.1"
33+
gem "rubocop-rspec", "~> 3.6.0"
3434

3535
gem "simplecov", require: false
3636
gem "simplecov-lcov", require: false

http.gemspec

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ Gem::Specification.new do |gem|
2727

2828
gem.required_ruby_version = ">= 3.0"
2929

30-
gem.add_runtime_dependency "addressable", "~> 2.8"
31-
gem.add_runtime_dependency "http-cookie", "~> 1.0"
32-
gem.add_runtime_dependency "http-form_data", "~> 2.2"
30+
gem.add_dependency "addressable", "~> 2.8"
31+
gem.add_dependency "http-cookie", "~> 1.0"
32+
gem.add_dependency "http-form_data", "~> 2.2"
3333

3434
# Use native llhttp for MRI (more performant) and llhttp-ffi for other interpreters (better compatibility)
3535
if RUBY_ENGINE == "ruby"
36-
gem.add_runtime_dependency "llhttp", "~> 0.6.1"
36+
gem.add_dependency "llhttp", "~> 0.6.1"
3737
else
38-
gem.add_runtime_dependency "llhttp-ffi", "~> 0.6.1"
38+
gem.add_dependency "llhttp-ffi", "~> 0.6.1"
3939
end
4040

4141
gem.metadata = {

lib/http/features/instrumentation.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,11 @@ def instrument(name, payload = {})
5757
end
5858
end
5959

60-
def start(_name, _payload)
60+
def start(_name, _payload) # rubocop:disable Naming/PredicateMethod
6161
true
6262
end
6363

64-
def finish(_name, _payload)
64+
def finish(_name, _payload) # rubocop:disable Naming/PredicateMethod
6565
true
6666
end
6767
end

lib/http/response.rb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,7 @@ def content_length
113113
value = @headers[Headers::CONTENT_LENGTH]
114114
return nil unless value
115115

116-
begin
117-
Integer(value)
118-
rescue ArgumentError
119-
nil
120-
end
116+
Integer(value, exception: false)
121117
end
122118

123119
# Parsed Content-Type header

spec/lib/http/client_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
stubbed_client = Class.new(HTTP::Client) do
1616
def perform(request, options)
1717
stubbed = stubs[HTTP::URI::NORMALIZER.call(request.uri).to_s]
18-
stubbed ? stubbed.call(request) : super(request, options)
18+
stubbed ? stubbed.call(request) : super
1919
end
2020

2121
def stubs

spec/lib/http/request/body_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
describe "#each" do
9999
let(:chunks) do
100100
chunks = []
101-
subject.each { |chunk| chunks << chunk.dup }
101+
subject.each { |chunk| chunks << chunk.dup } # rubocop:disable Style/MapIntoArray
102102
chunks
103103
end
104104

spec/support/ssl_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class RootCertificate < ::CertificateAuthority::Certificate
1111
EXTENSIONS = {"keyUsage" => {"usage" => %w[critical keyCertSign]}}.freeze
1212

1313
def initialize
14-
super()
14+
super
1515

1616
subject.common_name = "honestachmed.com"
1717
serial_number.number = 1

0 commit comments

Comments
 (0)