Skip to content

Commit b9f044f

Browse files
authored
Merge pull request #2292 from ksss/rbs-style-instance-with-instance
Apply rubocop style to RBS
2 parents 0117cf3 + 014faa5 commit b9f044f

File tree

12 files changed

+91
-87
lines changed

12 files changed

+91
-87
lines changed

.rubocop.yml

+4
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,16 @@ RBS/Style:
4646
- 'test/**/*'
4747
RBS/Style/BlockReturnBoolish:
4848
Enabled: true
49+
RBS/Style/ClassWithSingleton:
50+
Enabled: true
4951
RBS/Style/DuplicatedType:
5052
Enabled: true
5153
RBS/Style/EmptyArgument:
5254
Enabled: true
5355
RBS/Style/InitializeReturnType:
5456
Enabled: true
57+
RBS/Style/InstanceWithInstance:
58+
Enabled: true
5559
RBS/Style/OptionalNil:
5660
Enabled: true
5761
RBS/Style/RedundantParentheses:

core/data.rbs

+1-1
Original file line numberDiff line numberDiff line change
@@ -411,5 +411,5 @@ class Data
411411
# out = origin.with(z: 1) # ArgumentError: unknown keyword: :z
412412
# some_point = origin.with(1, 2) # ArgumentError: expected keyword arguments, got positional arguments
413413
#
414-
def with: (**untyped) -> instance
414+
def with: (**untyped) -> self
415415
end

core/exception.rbs

+1-1
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ class Exception
270270
# x0..equal?(x1) # => false
271271
#
272272
def exception: (?self) -> self
273-
| (string | _ToS message) -> instance
273+
| (string | _ToS message) -> self
274274

275275
# <!--
276276
# rdoc-file=error.c

core/method.rbs

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class Method
5454
#
5555
def hash: () -> Integer
5656

57-
def dup: () -> instance
57+
def dup: () -> self
5858

5959
# <!--
6060
# rdoc-file=proc.c
@@ -252,7 +252,7 @@ class Method
252252
# m.call # => "bar"
253253
# n = m.clone.call # => "bar"
254254
#
255-
def clone: () -> instance
255+
def clone: () -> self
256256

257257
# <!--
258258
# rdoc-file=proc.c

core/module.rbs

+2-2
Original file line numberDiff line numberDiff line change
@@ -731,8 +731,8 @@ class Module < Object
731731
# I'm Dino!
732732
# #<B:0x401b39e8>
733733
#
734-
def define_method: (interned symbol, ^() [self: instance] -> untyped | Method | UnboundMethod method) -> Symbol
735-
| (interned symbol) { () [self: instance] -> untyped } -> Symbol
734+
def define_method: (interned symbol, ^() [self: self] -> untyped | Method | UnboundMethod method) -> Symbol
735+
| (interned symbol) { () [self: self] -> untyped } -> Symbol
736736

737737
# <!--
738738
# rdoc-file=object.c

core/proc.rbs

+2-2
Original file line numberDiff line numberDiff line change
@@ -376,8 +376,8 @@ class Proc
376376
#
377377
def self.new: () { (?) -> untyped } -> instance
378378

379-
def clone: () -> instance
380-
def dup: () -> instance
379+
def clone: () -> self
380+
def dup: () -> self
381381

382382
# <!-- rdoc-file=proc.c -->
383383
# Invokes the block, setting the block's parameters to the values in *params*

core/rubygems/version.rbs

+2-2
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ module Gem
221221
#
222222
# Pre-release (alpha) parts, e.g, 5.3.1.b.2 => 5.4, are ignored.
223223
#
224-
def bump: () -> instance
224+
def bump: () -> self
225225

226226
# <!--
227227
# rdoc-file=lib/rubygems/version.rb
@@ -274,7 +274,7 @@ module Gem
274274
# The release for this version (e.g. 1.2.0.a -> 1.2.0). Non-prerelease versions
275275
# return themselves.
276276
#
277-
def release: () -> instance
277+
def release: () -> self
278278

279279
# <!--
280280
# rdoc-file=lib/rubygems/version.rb

core/string.rbs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1936,7 +1936,7 @@ class String
19361936
?crlf_newline: boolish,
19371937
?lf_newline: boolish,
19381938
?fallback: ^(String) -> string? | Method | _EncodeFallbackAref
1939-
) -> instance
1939+
) -> self
19401940

19411941
interface _EncodeFallbackAref
19421942
def []: (String) -> string?

core/unbound_method.rbs

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ class UnboundMethod
100100
# m.call # => "bar"
101101
# n = m.clone.call # => "bar"
102102
#
103-
def clone: () -> instance
103+
def clone: () -> self
104104

105105
# <!--
106106
# rdoc-file=proc.c

0 commit comments

Comments
 (0)