Skip to content

Commit 62d3f3e

Browse files
committed
⬆️ rubocop-lts
1 parent 56566b9 commit 62d3f3e

File tree

12 files changed

+38
-57
lines changed

12 files changed

+38
-57
lines changed

.rubocop_todo.yml

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config`
3-
# on 2022-06-22 19:08:01 UTC using RuboCop version 1.12.1.
3+
# on 2022-08-23 11:43:55 UTC using RuboCop version 1.30.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
@@ -33,10 +33,10 @@ Metrics/ClassLength:
3333
Metrics/CyclomaticComplexity:
3434
Max: 18
3535

36-
# Offense count: 74
36+
# Offense count: 75
3737
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
3838
Metrics/MethodLength:
39-
Max: 45
39+
Max: 43
4040

4141
# Offense count: 1
4242
# Configuration parameters: Max, CountKeywordArgs.
@@ -77,15 +77,6 @@ Security/Open:
7777
Exclude:
7878
- 'lib/oauth/cli/base_command.rb'
7979

80-
# Offense count: 2
81-
# Configuration parameters: AllowedChars.
82-
# AllowedChars: ©
83-
Style/AsciiComments:
84-
Exclude:
85-
- '**/*.md'
86-
- '**/*.markdown'
87-
- 'test/cases/spec/1_0-final/normalize_request_parameters_test.rb'
88-
8980
# Offense count: 2
9081
Style/ClassVars:
9182
Exclude:
@@ -98,25 +89,22 @@ Style/Documentation:
9889
Enabled: false
9990

10091
# Offense count: 3
101-
# Configuration parameters: MinBodyLength.
92+
# Configuration parameters: MinBodyLength, AllowConsecutiveConditionals.
10293
Style/GuardClause:
10394
Exclude:
10495
- 'lib/oauth/cli/sign_command.rb'
10596
- 'lib/oauth/consumer.rb'
10697
- 'lib/oauth/signature/base.rb'
10798

108-
# Offense count: 9
109-
# Cop supports --auto-correct.
99+
# Offense count: 2
100+
# This cop supports safe autocorrection (--autocorrect).
110101
Style/IfUnlessModifier:
111102
Exclude:
112-
- 'lib/oauth/cli/sign_command.rb'
113-
- 'lib/oauth/client/em_http.rb'
114-
- 'lib/oauth/consumer.rb'
103+
- 'bin/bundle'
115104
- 'lib/oauth/request_proxy/net_http.rb'
116-
- 'lib/oauth/signature/base.rb'
117105

118-
# Offense count: 2
119-
# Cop supports --auto-correct.
106+
# Offense count: 1
107+
# This cop supports unsafe autocorrection (--autocorrect-all).
120108
# Configuration parameters: InverseMethods, InverseBlocks.
121109
Style/InverseMethods:
122110
Exclude:
@@ -136,9 +124,10 @@ ThreadSafety/InstanceVariableInClassMethod:
136124
- 'lib/oauth/signature/base.rb'
137125

138126
# Offense count: 77
139-
# Cop supports --auto-correct.
140-
# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
127+
# This cop supports safe autocorrection (--autocorrect).
128+
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, IgnoredPatterns.
141129
# URISchemes: http, https
130+
# AllowedPatterns: (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#), (?-mix:^\#)
142131
# IgnoredPatterns: (?-mix:^\#)
143132
Layout/LineLength:
144133
Max: 429

.simplecov

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ if RUN_COVERAGE
2020
track_files "**/*.rb"
2121

2222
if ALL_FORMATTERS
23-
command_name "#{ENV["GITHUB_WORKFLOW"]} Job #{ENV["GITHUB_RUN_ID"]}:#{ENV["GITHUB_RUN_NUMBER"]}"
23+
command_name "#{ENV.fetch("GITHUB_WORKFLOW",
24+
nil)} Job #{ENV.fetch("GITHUB_RUN_ID", nil)}:#{ENV.fetch("GITHUB_RUN_NUMBER", nil)}"
2425
else
2526
formatter SimpleCov::Formatter::HTMLFormatter
2627
end

bin/bundle

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ m = Module.new do
1818
end
1919

2020
def env_var_version
21-
ENV["BUNDLER_VERSION"]
21+
ENV.fetch("BUNDLER_VERSION", nil)
2222
end
2323

2424
def cli_arg_version
@@ -38,7 +38,7 @@ m = Module.new do
3838
end
3939

4040
def gemfile
41-
gemfile = ENV["BUNDLE_GEMFILE"]
41+
gemfile = ENV.fetch("BUNDLE_GEMFILE", nil)
4242
return gemfile if gemfile && !gemfile.empty?
4343

4444
File.expand_path("../Gemfile", __dir__)
@@ -97,7 +97,9 @@ m = Module.new do
9797
require_error = activation_error_handling do
9898
require "bundler/version"
9999
end
100-
return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
100+
if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
101+
return
102+
end
101103

102104
warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`"
103105
exit 42

lib/oauth/cli/sign_command.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,7 @@ def puts_verbose_parameters(request)
4545
def puts_verbose_request(request)
4646
puts "Method: #{request.method}"
4747
puts "URI: #{request.uri}"
48-
unless options[:xmpp]
49-
puts "Normalized params: #{request.normalized_parameters}"
50-
end
48+
puts "Normalized params: #{request.normalized_parameters}" unless options[:xmpp]
5149
puts "Signature base string: #{request.signature_base_string}"
5250

5351
if xmpp?

lib/oauth/client/em_http.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,7 @@ def combine_query(path, query, uri_query)
8484
else
8585
query.to_s
8686
end
87-
unless uri_query.to_s.empty?
88-
combined_query = [combined_query, uri_query].reject(&:empty?).join("&")
89-
end
87+
combined_query = [combined_query, uri_query].reject(&:empty?).join("&") unless uri_query.to_s.empty?
9088
combined_query.to_s.empty? ? path : "#{path}?#{combined_query}"
9189
end
9290

lib/oauth/consumer.rb

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,7 @@ def get_access_token(request_token, request_options = {}, *arguments, &block)
159159
def get_request_token(request_options = {}, *arguments, &block)
160160
# if oauth_callback wasn't provided, it is assumed that oauth_verifiers
161161
# will be exchanged out of band
162-
unless request_options[:exclude_callback]
163-
request_options[:oauth_callback] ||= OAuth::OUT_OF_BAND
164-
end
162+
request_options[:oauth_callback] ||= OAuth::OUT_OF_BAND unless request_options[:exclude_callback]
165163

166164
response = if block
167165
token_request(
@@ -386,13 +384,9 @@ def create_http(_url = nil)
386384
end
387385

388386
http_object.read_timeout = http_object.open_timeout = @options[:timeout] || 60
389-
if @options[:open_timeout]
390-
http_object.open_timeout = @options[:open_timeout]
391-
end
387+
http_object.open_timeout = @options[:open_timeout] if @options[:open_timeout]
392388
http_object.ssl_version = @options[:ssl_version] if @options[:ssl_version]
393-
if @options[:ssl_client_cert]
394-
http_object.cert = @options[:ssl_client_cert]
395-
end
389+
http_object.cert = @options[:ssl_client_cert] if @options[:ssl_client_cert]
396390
http_object.key = @options[:ssl_client_key] if @options[:ssl_client_key]
397391
http_object.set_debug_output(debug_output) if debug_output
398392

@@ -409,9 +403,7 @@ def create_http_request(http_method, path, *arguments)
409403
# only add if the site host matches the current http object's host
410404
# (in case we've specified a full url for token requests)
411405
uri = URI.parse(site)
412-
if uri.path && uri.path != "/" && uri.host == http.address
413-
path = uri.path + path
414-
end
406+
path = uri.path + path if uri.path && uri.path != "/" && uri.host == http.address
415407

416408
headers = arguments.first.is_a?(Hash) ? arguments.shift : {}
417409

lib/oauth/request_proxy/base.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def parameters
7979
end
8080

8181
def parameters_for_signature
82-
parameters.select { |k, _v| !signature_and_unsigned_parameters.include?(k) }
82+
parameters.reject { |k, _v| signature_and_unsigned_parameters.include?(k) }
8383
end
8484

8585
def oauth_parameters

lib/oauth/request_proxy/net_http.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,7 @@ def post_params
6969
end
7070

7171
def auth_header_params
72-
unless request["Authorization"] && request["Authorization"][0, 5] == "OAuth"
73-
return nil
74-
end
72+
return nil unless request["Authorization"] && request["Authorization"][0, 5] == "OAuth"
7573

7674
request["Authorization"]
7775
end

lib/oauth/signature/base.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@ def initialize(request, options = {}, &block)
3131
@consumer_secret = options[:consumer].secret if options[:consumer]
3232

3333
# presence of :consumer_secret option will override any Consumer that's provided
34-
if options[:consumer_secret]
35-
@consumer_secret = options[:consumer_secret]
36-
end
34+
@consumer_secret = options[:consumer_secret] if options[:consumer_secret]
3735

3836
## token secret was determined beforehand
3937

oauth.gemspec

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ Gem::Specification.new do |spec|
2424
spec.metadata["wiki_uri"] = "#{spec.homepage}/wiki"
2525
spec.metadata["rubygems_mfa_required"] = "true"
2626

27-
spec.files = Dir.glob("lib/**/*.rb") + ["LICENSE", "README.md", "CHANGELOG.md", "CODE_OF_CONDUCT.md", "SECURITY.md", "CONTRIBUTING.md"]
27+
spec.files = Dir.glob("lib/**/*.rb") + ["LICENSE", "README.md", "CHANGELOG.md", "CODE_OF_CONDUCT.md", "SECURITY.md",
28+
"CONTRIBUTING.md"]
2829
spec.extra_rdoc_files = ["TODO"]
2930

3031
# This gem will work with Ruby 2.4 or greater...
@@ -63,7 +64,7 @@ Thanks, |7eter l-|. l3oling
6364
spec.add_development_dependency("rack-test")
6465
spec.add_development_dependency("rake", "~> 13.0")
6566
spec.add_development_dependency("rest-client")
66-
spec.add_development_dependency("rubocop-lts", "~> 12.0")
67+
spec.add_development_dependency("rubocop-lts", "~> 18.0")
6768
spec.add_development_dependency("typhoeus", ">= 0.1.13")
6869
spec.add_development_dependency("webmock", "<= 3.14.0")
6970
end

0 commit comments

Comments
 (0)