Skip to content

Commit dc6a0c3

Browse files
committed
chore: Auto correct with rubocop-performance
1 parent 9b0b7c1 commit dc6a0c3

File tree

5 files changed

+10
-3
lines changed

5 files changed

+10
-3
lines changed

.rubocop.yml

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
require:
22
- rubocop-rake
33
- rubocop-rspec
4+
- rubocop-performance
45

56
AllCops:
67
TargetRubyVersion: 3.1

Gemfile

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ gem "rake"
99
gem "rbs-inline", require: false
1010
gem "rspec"
1111
gem "rubocop", require: false
12+
gem "rubocop-performance", require: false
1213
gem "rubocop-rake", require: false
1314
gem "rubocop-rspec", require: false
1415
gem "simplecov"

Gemfile.lock

+5
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ GEM
3131
docile (1.4.1)
3232
drb (2.2.1)
3333
ffi (1.17.0)
34+
ffi (1.17.0-arm64-darwin)
3435
fileutils (1.7.3)
3536
i18n (1.14.6)
3637
concurrent-ruby (~> 1.0)
@@ -84,6 +85,9 @@ GEM
8485
unicode-display_width (>= 2.4.0, < 4.0)
8586
rubocop-ast (1.37.0)
8687
parser (>= 3.3.1.0)
88+
rubocop-performance (1.23.1)
89+
rubocop (>= 1.48.1, < 2.0)
90+
rubocop-ast (>= 1.31.1, < 2.0)
8791
rubocop-rake (0.6.0)
8892
rubocop (~> 1.0)
8993
rubocop-rspec (3.3.0)
@@ -134,6 +138,7 @@ DEPENDENCIES
134138
rbs-trace!
135139
rspec
136140
rubocop
141+
rubocop-performance
137142
rubocop-rake
138143
rubocop-rspec
139144
simplecov

lib/rbs/trace/overload_compact.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def merge_method_types(method_types) # rubocop:disable Metrics
7474
def merge_types(types)
7575
return types.first if types.one?
7676

77-
optional = types.any? { |type| type.is_a?(Types::Bases::Nil) }
77+
optional = types.any?(Types::Bases::Nil)
7878
types = types.reject { |type| type.is_a?(Types::Bases::Nil) }
7979
type = types.one? ? types.first : Types::Union.new(types:, location: nil) #: Types::t
8080

spec/support/trace_helper.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44

55
module TraceHelper
66
# @rbs (String) { (Module) -> void } -> void
7-
def load_source(source, &block)
7+
def load_source(source)
88
tf = Tempfile.open(["", ".rb"]) do |fp|
99
fp.write(source)
1010
fp
1111
end
1212
mod = Module.new
1313
load(tf.path, mod)
1414

15-
block.call(mod)
15+
yield(mod)
1616
end
1717
end
1818

0 commit comments

Comments
 (0)