twirbet 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rspec +3 -0
- data/.rubocop.yml +20 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile +28 -0
- data/Gemfile.lock +127 -0
- data/LICENSE.txt +21 -0
- data/README.md +144 -0
- data/Rakefile +17 -0
- data/examples/clientcompat/client +28 -0
- data/examples/clientcompat/clientcompat.proto +29 -0
- data/examples/clientcompat/clientcompat_pb.rb +36 -0
- data/examples/clientcompat/clientcompat_twirbet.rb +57 -0
- data/examples/ping/Gemfile +11 -0
- data/examples/ping/Gemfile.lock +69 -0
- data/examples/ping/bin/puma +27 -0
- data/examples/ping/bin/pumactl +27 -0
- data/examples/ping/bin/srb +27 -0
- data/examples/ping/bin/srb-rbi +27 -0
- data/examples/ping/bin/tapioca +27 -0
- data/examples/ping/client.rb +14 -0
- data/examples/ping/config/application.rb +13 -0
- data/examples/ping/config/environment.rb +6 -0
- data/examples/ping/config.ru +8 -0
- data/examples/ping/proto/ping.proto +15 -0
- data/examples/ping/proto/ping_pb.rb +20 -0
- data/examples/ping/proto/ping_twirbet.rb +47 -0
- data/examples/ping/sorbet/config +4 -0
- data/examples/ping/sorbet/rbi/dsl/google/protobuf/descriptor_proto/extension_range.rbi +34 -0
- data/examples/ping/sorbet/rbi/dsl/google/protobuf/descriptor_proto/reserved_range.rbi +22 -0
- data/examples/ping/sorbet/rbi/dsl/google/protobuf/descriptor_proto.rbi +83 -0
- data/examples/ping/sorbet/rbi/dsl/google/protobuf/enum_descriptor_proto/enum_reserved_range.rbi +22 -0
- data/examples/ping/sorbet/rbi/dsl/google/protobuf/enum_descriptor_proto.rbi +48 -0
- data/examples/ping/sorbet/rbi/dsl/google/protobuf/enum_options.rbi +34 -0
- data/examples/ping/sorbet/rbi/dsl/google/protobuf/enum_value_descriptor_proto.rbi +34 -0
- data/examples/ping/sorbet/rbi/dsl/google/protobuf/enum_value_options.rbi +27 -0
- data/examples/ping/sorbet/rbi/dsl/google/protobuf/extension_range_options.rbi +20 -0
- data/examples/ping/sorbet/rbi/dsl/google/protobuf/field_descriptor_proto/label.rbi +22 -0
- data/examples/ping/sorbet/rbi/dsl/google/protobuf/field_descriptor_proto/type.rbi +37 -0
- data/examples/ping/sorbet/rbi/dsl/google/protobuf/field_descriptor_proto.rbi +90 -0
- data/examples/ping/sorbet/rbi/dsl/google/protobuf/field_options/c_type.rbi +22 -0
- data/examples/ping/sorbet/rbi/dsl/google/protobuf/field_options/js_type.rbi +22 -0
- data/examples/ping/sorbet/rbi/dsl/google/protobuf/field_options.rbi +69 -0
- data/examples/ping/sorbet/rbi/dsl/google/protobuf/file_descriptor_proto.rbi +97 -0
- data/examples/ping/sorbet/rbi/dsl/google/protobuf/file_descriptor_set.rbi +20 -0
- data/examples/ping/sorbet/rbi/dsl/google/protobuf/file_options/optimize_mode.rbi +22 -0
- data/examples/ping/sorbet/rbi/dsl/google/protobuf/file_options.rbi +160 -0
- data/examples/ping/sorbet/rbi/dsl/google/protobuf/generated_code_info/annotation.rbi +41 -0
- data/examples/ping/sorbet/rbi/dsl/google/protobuf/generated_code_info.rbi +20 -0
- data/examples/ping/sorbet/rbi/dsl/google/protobuf/map.rbi +12 -0
- data/examples/ping/sorbet/rbi/dsl/google/protobuf/message_options.rbi +48 -0
- data/examples/ping/sorbet/rbi/dsl/google/protobuf/method_descriptor_proto.rbi +55 -0
- data/examples/ping/sorbet/rbi/dsl/google/protobuf/method_options/idempotency_level.rbi +22 -0
- data/examples/ping/sorbet/rbi/dsl/google/protobuf/method_options.rbi +34 -0
- data/examples/ping/sorbet/rbi/dsl/google/protobuf/oneof_descriptor_proto.rbi +22 -0
- data/examples/ping/sorbet/rbi/dsl/google/protobuf/oneof_options.rbi +20 -0
- data/examples/ping/sorbet/rbi/dsl/google/protobuf/repeated_field.rbi +11 -0
- data/examples/ping/sorbet/rbi/dsl/google/protobuf/service_descriptor_proto.rbi +34 -0
- data/examples/ping/sorbet/rbi/dsl/google/protobuf/service_options.rbi +27 -0
- data/examples/ping/sorbet/rbi/dsl/google/protobuf/source_code_info/location.rbi +48 -0
- data/examples/ping/sorbet/rbi/dsl/google/protobuf/source_code_info.rbi +20 -0
- data/examples/ping/sorbet/rbi/dsl/google/protobuf/uninterpreted_option/name_part.rbi +22 -0
- data/examples/ping/sorbet/rbi/dsl/google/protobuf/uninterpreted_option.rbi +62 -0
- data/examples/ping/sorbet/rbi/dsl/ping/ping_request.rbi +16 -0
- data/examples/ping/sorbet/rbi/dsl/ping/ping_response.rbi +16 -0
- data/examples/ping/sorbet/rbi/gems/ast@2.4.2.rbi +584 -0
- data/examples/ping/sorbet/rbi/gems/diff-lcs@1.5.0.rbi +8 -0
- data/examples/ping/sorbet/rbi/gems/google-protobuf@3.21.12.rbi +1645 -0
- data/examples/ping/sorbet/rbi/gems/netrc@0.11.0.rbi +158 -0
- data/examples/ping/sorbet/rbi/gems/nio4r@2.5.8.rbi +8 -0
- data/examples/ping/sorbet/rbi/gems/parallel@1.22.1.rbi +277 -0
- data/examples/ping/sorbet/rbi/gems/parser@3.1.3.0.rbi +5076 -0
- data/examples/ping/sorbet/rbi/gems/puma@6.0.0.rbi +4177 -0
- data/examples/ping/sorbet/rbi/gems/rack@3.0.2.rbi +5016 -0
- data/examples/ping/sorbet/rbi/gems/rbi@0.0.16.rbi +3008 -0
- data/examples/ping/sorbet/rbi/gems/spoom@1.1.15.rbi +2383 -0
- data/examples/ping/sorbet/rbi/gems/tapioca@0.10.3.rbi +3032 -0
- data/examples/ping/sorbet/rbi/gems/thor@1.2.1.rbi +3919 -0
- data/examples/ping/sorbet/rbi/gems/twirbet@0.1.0.rbi +528 -0
- data/examples/ping/sorbet/rbi/gems/unparser@0.6.5.rbi +8 -0
- data/examples/ping/sorbet/rbi/gems/webrick@1.7.0.rbi +2498 -0
- data/examples/ping/sorbet/rbi/gems/yard-sorbet@0.7.0.rbi +391 -0
- data/examples/ping/sorbet/rbi/gems/yard@0.9.28.rbi +17022 -0
- data/examples/ping/sorbet/tapioca/config.yml +13 -0
- data/examples/ping/sorbet/tapioca/require.rb +5 -0
- data/lib/twirbet/client.rb +45 -0
- data/lib/twirbet/dsl.rb +84 -0
- data/lib/twirbet/encoding.rb +52 -0
- data/lib/twirbet/errors.rb +375 -0
- data/lib/twirbet/method.rb +34 -0
- data/lib/twirbet/service.rb +85 -0
- data/lib/twirbet/transport.rb +55 -0
- data/lib/twirbet/transports/fake_transport.rb +32 -0
- data/lib/twirbet/transports/net_http_transport.rb +20 -0
- data/lib/twirbet/version.rb +6 -0
- data/lib/twirbet.rb +11 -0
- data/sorbet/config +5 -0
- data/sorbet/rbi/annotations/rainbow.rbi +269 -0
- data/sorbet/rbi/custom/ping.rbi +23 -0
- data/sorbet/rbi/gems/ast@2.4.2.rbi +584 -0
- data/sorbet/rbi/gems/diff-lcs@1.5.0.rbi +1064 -0
- data/sorbet/rbi/gems/google-protobuf@3.21.12.rbi +1645 -0
- data/sorbet/rbi/gems/json@2.6.3.rbi +1541 -0
- data/sorbet/rbi/gems/netrc@0.11.0.rbi +158 -0
- data/sorbet/rbi/gems/parallel@1.22.1.rbi +277 -0
- data/sorbet/rbi/gems/parser@3.1.3.0.rbi +6878 -0
- data/sorbet/rbi/gems/rack@3.0.2.rbi +5163 -0
- data/sorbet/rbi/gems/rainbow@3.1.1.rbi +397 -0
- data/sorbet/rbi/gems/rake@13.0.6.rbi +2946 -0
- data/sorbet/rbi/gems/rbi@0.0.16.rbi +3008 -0
- data/sorbet/rbi/gems/regexp_parser@2.6.1.rbi +3126 -0
- data/sorbet/rbi/gems/rexml@3.2.5.rbi +4660 -0
- data/sorbet/rbi/gems/rspec-core@3.12.0.rbi +10492 -0
- data/sorbet/rbi/gems/rspec-expectations@3.12.1.rbi +7817 -0
- data/sorbet/rbi/gems/rspec-mocks@3.12.1.rbi +4994 -0
- data/sorbet/rbi/gems/rspec-support@3.12.0.rbi +1477 -0
- data/sorbet/rbi/gems/rspec@3.12.0.rbi +10 -0
- data/sorbet/rbi/gems/rubocop-ast@1.24.0.rbi +6790 -0
- data/sorbet/rbi/gems/rubocop-rake@0.6.0.rbi +354 -0
- data/sorbet/rbi/gems/rubocop-rspec@2.16.0.rbi +7650 -0
- data/sorbet/rbi/gems/rubocop-shopify@2.10.1.rbi +8 -0
- data/sorbet/rbi/gems/rubocop-sorbet@0.6.11.rbi +1014 -0
- data/sorbet/rbi/gems/rubocop@1.40.0.rbi +51560 -0
- data/sorbet/rbi/gems/ruby-progressbar@1.11.0.rbi +1212 -0
- data/sorbet/rbi/gems/spoom@1.1.15.rbi +2383 -0
- data/sorbet/rbi/gems/tapioca@0.10.3.rbi +3032 -0
- data/sorbet/rbi/gems/thor@1.2.1.rbi +3950 -0
- data/sorbet/rbi/gems/unicode-display_width@2.3.0.rbi +46 -0
- data/sorbet/rbi/gems/unparser@0.6.5.rbi +4265 -0
- data/sorbet/rbi/gems/webrick@1.7.0.rbi +2498 -0
- data/sorbet/rbi/gems/yard-sorbet@0.7.0.rbi +391 -0
- data/sorbet/rbi/gems/yard@0.9.28.rbi +17033 -0
- data/sorbet/tapioca/config.yml +13 -0
- data/sorbet/tapioca/require.rb +4 -0
- data/twirbet.gemspec +36 -0
- metadata +223 -0
@@ -0,0 +1,1014 @@
|
|
1
|
+
# typed: true
|
2
|
+
|
3
|
+
# DO NOT EDIT MANUALLY
|
4
|
+
# This is an autogenerated file for types exported from the `rubocop-sorbet` gem.
|
5
|
+
# Please instead update this file by running `bin/tapioca gem rubocop-sorbet`.
|
6
|
+
|
7
|
+
module RuboCop; end
|
8
|
+
class RuboCop::ConfigNotFoundError < ::RuboCop::Error; end
|
9
|
+
module RuboCop::Cop; end
|
10
|
+
|
11
|
+
module RuboCop::Cop::ConfigurableNaming
|
12
|
+
include ::RuboCop::Cop::ConfigurableEnforcedStyle
|
13
|
+
include ::RuboCop::Cop::ConfigurableFormatting
|
14
|
+
end
|
15
|
+
|
16
|
+
# source://rubocop/1.40.0/lib/rubocop/cop/mixin/configurable_naming.rb#10
|
17
|
+
RuboCop::Cop::ConfigurableNaming::FORMATS = T.let(T.unsafe(nil), Hash)
|
18
|
+
|
19
|
+
module RuboCop::Cop::ConfigurableNumbering
|
20
|
+
include ::RuboCop::Cop::ConfigurableEnforcedStyle
|
21
|
+
include ::RuboCop::Cop::ConfigurableFormatting
|
22
|
+
end
|
23
|
+
|
24
|
+
# source://rubocop/1.40.0/lib/rubocop/cop/mixin/configurable_numbering.rb#11
|
25
|
+
RuboCop::Cop::ConfigurableNumbering::FORMATS = T.let(T.unsafe(nil), Hash)
|
26
|
+
|
27
|
+
# source://rubocop/1.40.0/lib/rubocop/cop/mixin/allowed_methods.rb#38
|
28
|
+
RuboCop::Cop::IgnoredMethods = RuboCop::Cop::AllowedMethods
|
29
|
+
|
30
|
+
# source://rubocop/1.40.0/lib/rubocop/cop/mixin/allowed_pattern.rb#54
|
31
|
+
RuboCop::Cop::IgnoredPattern = RuboCop::Cop::AllowedPattern
|
32
|
+
|
33
|
+
module RuboCop::Cop::Sorbet; end
|
34
|
+
|
35
|
+
# This cop disallows using `.override(allow_incompatible: true)`.
|
36
|
+
# Using `allow_incompatible` suggests a violation of the Liskov
|
37
|
+
# Substitution Principle, meaning that a subclass is not a valid
|
38
|
+
# subtype of it's superclass. This Cop prevents these design smells
|
39
|
+
# from occurring.
|
40
|
+
#
|
41
|
+
# @example
|
42
|
+
#
|
43
|
+
# # bad
|
44
|
+
# sig.override(allow_incompatible: true)
|
45
|
+
#
|
46
|
+
# # good
|
47
|
+
# sig.override
|
48
|
+
class RuboCop::Cop::Sorbet::AllowIncompatibleOverride < ::RuboCop::Cop::Cop
|
49
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/allow_incompatible_override.rb#35
|
50
|
+
def allow_incompatible?(param0); end
|
51
|
+
|
52
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/allow_incompatible_override.rb#39
|
53
|
+
def allow_incompatible_override?(param0 = T.unsafe(nil)); end
|
54
|
+
|
55
|
+
# @return [Boolean]
|
56
|
+
#
|
57
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/allow_incompatible_override.rb#31
|
58
|
+
def not_nil?(node); end
|
59
|
+
|
60
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/allow_incompatible_override.rb#48
|
61
|
+
def on_send(node); end
|
62
|
+
|
63
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/allow_incompatible_override.rb#22
|
64
|
+
def sig?(param0); end
|
65
|
+
end
|
66
|
+
|
67
|
+
# This cop disallows binding the return value of `T.any`, `T.all`, `T.enum`
|
68
|
+
# to a constant directly. To bind the value, one must use `T.type_alias`.
|
69
|
+
#
|
70
|
+
# @example
|
71
|
+
#
|
72
|
+
# # bad
|
73
|
+
# FooOrBar = T.any(Foo, Bar)
|
74
|
+
#
|
75
|
+
# # good
|
76
|
+
# FooOrBar = T.type_alias { T.any(Foo, Bar) }
|
77
|
+
class RuboCop::Cop::Sorbet::BindingConstantWithoutTypeAlias < ::RuboCop::Cop::Cop
|
78
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/binding_constants_without_type_alias.rb#116
|
79
|
+
def autocorrect(node); end
|
80
|
+
|
81
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/binding_constants_without_type_alias.rb#19
|
82
|
+
def binding_unaliased_type?(param0 = T.unsafe(nil)); end
|
83
|
+
|
84
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/binding_constants_without_type_alias.rb#51
|
85
|
+
def dynamic_type_creation_with_block?(param0 = T.unsafe(nil)); end
|
86
|
+
|
87
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/binding_constants_without_type_alias.rb#66
|
88
|
+
def generic_parameter_decl_block_call?(param0 = T.unsafe(nil)); end
|
89
|
+
|
90
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/binding_constants_without_type_alias.rb#60
|
91
|
+
def generic_parameter_decl_call?(param0 = T.unsafe(nil)); end
|
92
|
+
|
93
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/binding_constants_without_type_alias.rb#72
|
94
|
+
def method_needing_aliasing_on_t?(param0); end
|
95
|
+
|
96
|
+
# @return [Boolean]
|
97
|
+
#
|
98
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/binding_constants_without_type_alias.rb#85
|
99
|
+
def not_dynamic_type_creation_with_block?(node); end
|
100
|
+
|
101
|
+
# @return [Boolean]
|
102
|
+
#
|
103
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/binding_constants_without_type_alias.rb#89
|
104
|
+
def not_generic_parameter_decl?(node); end
|
105
|
+
|
106
|
+
# @return [Boolean]
|
107
|
+
#
|
108
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/binding_constants_without_type_alias.rb#93
|
109
|
+
def not_nil?(node); end
|
110
|
+
|
111
|
+
# @return [Boolean]
|
112
|
+
#
|
113
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/binding_constants_without_type_alias.rb#81
|
114
|
+
def not_t_let?(node); end
|
115
|
+
|
116
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/binding_constants_without_type_alias.rb#97
|
117
|
+
def on_casgn(node); end
|
118
|
+
|
119
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/binding_constants_without_type_alias.rb#41
|
120
|
+
def t_let?(param0 = T.unsafe(nil)); end
|
121
|
+
|
122
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/binding_constants_without_type_alias.rb#32
|
123
|
+
def using_deprecated_type_alias_syntax?(param0 = T.unsafe(nil)); end
|
124
|
+
|
125
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/binding_constants_without_type_alias.rb#23
|
126
|
+
def using_type_alias?(param0 = T.unsafe(nil)); end
|
127
|
+
end
|
128
|
+
|
129
|
+
# This cop ensures that callback conditionals are bound to the right type
|
130
|
+
# so that they are type checked properly.
|
131
|
+
#
|
132
|
+
# Auto-correction is unsafe because other libraries define similar style callbacks as Rails, but don't always need
|
133
|
+
# binding to the attached class. Auto-correcting those usages can lead to false positives and auto-correction
|
134
|
+
# introduces new typing errors.
|
135
|
+
#
|
136
|
+
# @example
|
137
|
+
#
|
138
|
+
# # bad
|
139
|
+
# class Post < ApplicationRecord
|
140
|
+
# before_create :do_it, if: -> { should_do_it? }
|
141
|
+
#
|
142
|
+
# def should_do_it?
|
143
|
+
# true
|
144
|
+
# end
|
145
|
+
# end
|
146
|
+
#
|
147
|
+
# # good
|
148
|
+
# class Post < ApplicationRecord
|
149
|
+
# before_create :do_it, if: -> {
|
150
|
+
# T.bind(self, Post)
|
151
|
+
# should_do_it?
|
152
|
+
# }
|
153
|
+
#
|
154
|
+
# def should_do_it?
|
155
|
+
# true
|
156
|
+
# end
|
157
|
+
# end
|
158
|
+
class RuboCop::Cop::Sorbet::CallbackConditionalsBinding < ::RuboCop::Cop::Cop
|
159
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/callback_conditionals_binding.rb#47
|
160
|
+
def autocorrect(node); end
|
161
|
+
|
162
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/callback_conditionals_binding.rb#99
|
163
|
+
def on_send(node); end
|
164
|
+
end
|
165
|
+
|
166
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/callback_conditionals_binding.rb#36
|
167
|
+
RuboCop::Cop::Sorbet::CallbackConditionalsBinding::CALLBACKS = T.let(T.unsafe(nil), Array)
|
168
|
+
|
169
|
+
# This cop disallows the usage of `checked(true)`. This usage could cause
|
170
|
+
# confusion; it could lead some people to believe that a method would be checked
|
171
|
+
# even if runtime checks have not been enabled on the class or globally.
|
172
|
+
# Additionally, in the event where checks are enabled, `checked(true)` would
|
173
|
+
# be redundant; only `checked(false)` or `soft` would change the behaviour.
|
174
|
+
#
|
175
|
+
# @example
|
176
|
+
#
|
177
|
+
# # bad
|
178
|
+
# sig { void.checked(true) }
|
179
|
+
#
|
180
|
+
# # good
|
181
|
+
# sig { void }
|
182
|
+
class RuboCop::Cop::Sorbet::CheckedTrueInSignature < ::RuboCop::Cop::Sorbet::SignatureCop
|
183
|
+
include ::RuboCop::Cop::RangeHelp
|
184
|
+
|
185
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/checked_true_in_signature.rb#25
|
186
|
+
def offending_node(param0); end
|
187
|
+
|
188
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/checked_true_in_signature.rb#36
|
189
|
+
def on_signature(node); end
|
190
|
+
end
|
191
|
+
|
192
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/checked_true_in_signature.rb#29
|
193
|
+
RuboCop::Cop::Sorbet::CheckedTrueInSignature::MESSAGE = T.let(T.unsafe(nil), String)
|
194
|
+
|
195
|
+
# This cop disallows the calls that are used to get constants fom Strings
|
196
|
+
# such as +constantize+, +const_get+, and +constants+.
|
197
|
+
#
|
198
|
+
# The goal of this cop is to make the code easier to statically analyze,
|
199
|
+
# more IDE-friendly, and more predictable. It leads to code that clearly
|
200
|
+
# expresses which values the constant can have.
|
201
|
+
#
|
202
|
+
# @example
|
203
|
+
#
|
204
|
+
# # bad
|
205
|
+
# class_name.constantize
|
206
|
+
#
|
207
|
+
# # bad
|
208
|
+
# constants.detect { |c| c.name == "User" }
|
209
|
+
#
|
210
|
+
# # bad
|
211
|
+
# const_get(class_name)
|
212
|
+
#
|
213
|
+
# # good
|
214
|
+
# case class_name
|
215
|
+
# when "User"
|
216
|
+
# User
|
217
|
+
# else
|
218
|
+
# raise ArgumentError
|
219
|
+
# end
|
220
|
+
#
|
221
|
+
# # good
|
222
|
+
# { "User" => User }.fetch(class_name)
|
223
|
+
class RuboCop::Cop::Sorbet::ConstantsFromStrings < ::RuboCop::Cop::Cop
|
224
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/constants_from_strings.rb#37
|
225
|
+
def constant_from_string?(param0 = T.unsafe(nil)); end
|
226
|
+
|
227
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/constants_from_strings.rb#41
|
228
|
+
def on_send(node); end
|
229
|
+
end
|
230
|
+
|
231
|
+
# This cop checks that the Sorbet sigil comes as the first magic comment in the file.
|
232
|
+
#
|
233
|
+
# The expected order for magic comments is: typed, (en)?coding, warn_indent then frozen_string_literal.
|
234
|
+
#
|
235
|
+
# For example, the following bad ordering:
|
236
|
+
#
|
237
|
+
# ```ruby
|
238
|
+
# class Foo; end
|
239
|
+
# ```
|
240
|
+
#
|
241
|
+
# Will be corrected as:
|
242
|
+
#
|
243
|
+
# ```ruby
|
244
|
+
# class Foo; end
|
245
|
+
# ```
|
246
|
+
#
|
247
|
+
# Only `typed`, `(en)?coding`, `warn_indent` and `frozen_string_literal` magic comments are considered,
|
248
|
+
# other comments or magic comments are left in the same place.
|
249
|
+
class RuboCop::Cop::Sorbet::EnforceSigilOrder < ::RuboCop::Cop::Sorbet::ValidSigil
|
250
|
+
include ::RuboCop::Cop::RangeHelp
|
251
|
+
|
252
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/enforce_sigil_order.rb#42
|
253
|
+
def autocorrect(_node); end
|
254
|
+
|
255
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/enforce_sigil_order.rb#33
|
256
|
+
def investigate(processed_source); end
|
257
|
+
|
258
|
+
protected
|
259
|
+
|
260
|
+
# checks
|
261
|
+
#
|
262
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/enforce_sigil_order.rb#91
|
263
|
+
def check_magic_comments_order(tokens); end
|
264
|
+
|
265
|
+
# Get all the tokens in `processed_source` that match `MAGIC_REGEX`
|
266
|
+
#
|
267
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/enforce_sigil_order.rb#83
|
268
|
+
def extract_magic_comments(processed_source); end
|
269
|
+
end
|
270
|
+
|
271
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/enforce_sigil_order.rb#67
|
272
|
+
RuboCop::Cop::Sorbet::EnforceSigilOrder::CODING_REGEX = T.let(T.unsafe(nil), Regexp)
|
273
|
+
|
274
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/enforce_sigil_order.rb#69
|
275
|
+
RuboCop::Cop::Sorbet::EnforceSigilOrder::FROZEN_REGEX = T.let(T.unsafe(nil), Regexp)
|
276
|
+
|
277
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/enforce_sigil_order.rb#68
|
278
|
+
RuboCop::Cop::Sorbet::EnforceSigilOrder::INDENT_REGEX = T.let(T.unsafe(nil), Regexp)
|
279
|
+
|
280
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/enforce_sigil_order.rb#78
|
281
|
+
RuboCop::Cop::Sorbet::EnforceSigilOrder::MAGIC_REGEX = T.let(T.unsafe(nil), Regexp)
|
282
|
+
|
283
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/enforce_sigil_order.rb#71
|
284
|
+
RuboCop::Cop::Sorbet::EnforceSigilOrder::PREFERRED_ORDER = T.let(T.unsafe(nil), Hash)
|
285
|
+
|
286
|
+
# This cop checks that every method definition and attribute accessor has a Sorbet signature.
|
287
|
+
#
|
288
|
+
# It also suggest an autocorrect with placeholders so the following code:
|
289
|
+
#
|
290
|
+
# ```
|
291
|
+
# def foo(a, b, c); end
|
292
|
+
# ```
|
293
|
+
#
|
294
|
+
# Will be corrected as:
|
295
|
+
#
|
296
|
+
# ```
|
297
|
+
# sig { params(a: T.untyped, b: T.untyped, c: T.untyped).returns(T.untyped)
|
298
|
+
# def foo(a, b, c); end
|
299
|
+
# ```
|
300
|
+
#
|
301
|
+
# You can configure the placeholders used by changing the following options:
|
302
|
+
#
|
303
|
+
# * `ParameterTypePlaceholder`: placeholders used for parameter types (default: 'T.untyped')
|
304
|
+
# * `ReturnTypePlaceholder`: placeholders used for return types (default: 'T.untyped')
|
305
|
+
class RuboCop::Cop::Sorbet::EnforceSignatures < ::RuboCop::Cop::Sorbet::SignatureCop
|
306
|
+
# @return [EnforceSignatures] a new instance of EnforceSignatures
|
307
|
+
#
|
308
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/enforce_signatures.rb#30
|
309
|
+
def initialize(config = T.unsafe(nil), options = T.unsafe(nil)); end
|
310
|
+
|
311
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/enforce_signatures.rb#35
|
312
|
+
def accessor?(param0 = T.unsafe(nil)); end
|
313
|
+
|
314
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/enforce_signatures.rb#55
|
315
|
+
def autocorrect(node); end
|
316
|
+
|
317
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/enforce_signatures.rb#39
|
318
|
+
def on_def(node); end
|
319
|
+
|
320
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/enforce_signatures.rb#43
|
321
|
+
def on_defs(node); end
|
322
|
+
|
323
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/enforce_signatures.rb#47
|
324
|
+
def on_send(node); end
|
325
|
+
|
326
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/enforce_signatures.rb#51
|
327
|
+
def on_signature(node); end
|
328
|
+
|
329
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/enforce_signatures.rb#74
|
330
|
+
def scope(node); end
|
331
|
+
|
332
|
+
private
|
333
|
+
|
334
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/enforce_signatures.rb#82
|
335
|
+
def check_node(node); end
|
336
|
+
|
337
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/enforce_signatures.rb#93
|
338
|
+
def param_type_placeholder; end
|
339
|
+
|
340
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/enforce_signatures.rb#97
|
341
|
+
def return_type_placeholder; end
|
342
|
+
end
|
343
|
+
|
344
|
+
class RuboCop::Cop::Sorbet::EnforceSignatures::SigSuggestion
|
345
|
+
# @return [SigSuggestion] a new instance of SigSuggestion
|
346
|
+
#
|
347
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/enforce_signatures.rb#104
|
348
|
+
def initialize(indent, param_placeholder, return_placeholder); end
|
349
|
+
|
350
|
+
# Returns the value of attribute params.
|
351
|
+
#
|
352
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/enforce_signatures.rb#102
|
353
|
+
def params; end
|
354
|
+
|
355
|
+
# Sets the attribute params
|
356
|
+
#
|
357
|
+
# @param value the value to set the attribute params to.
|
358
|
+
#
|
359
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/enforce_signatures.rb#102
|
360
|
+
def params=(_arg0); end
|
361
|
+
|
362
|
+
# Returns the value of attribute returns.
|
363
|
+
#
|
364
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/enforce_signatures.rb#102
|
365
|
+
def returns; end
|
366
|
+
|
367
|
+
# Sets the attribute returns
|
368
|
+
#
|
369
|
+
# @param value the value to set the attribute returns to.
|
370
|
+
#
|
371
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/enforce_signatures.rb#102
|
372
|
+
def returns=(_arg0); end
|
373
|
+
|
374
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/enforce_signatures.rb#112
|
375
|
+
def to_autocorrect; end
|
376
|
+
|
377
|
+
private
|
378
|
+
|
379
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/enforce_signatures.rb#124
|
380
|
+
def generate_params; end
|
381
|
+
|
382
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/enforce_signatures.rb#135
|
383
|
+
def generate_return; end
|
384
|
+
end
|
385
|
+
|
386
|
+
# This cop checks that there is only one Sorbet sigil in a given file
|
387
|
+
#
|
388
|
+
# For example, the following class with two sigils
|
389
|
+
#
|
390
|
+
# ```ruby
|
391
|
+
# class Foo; end
|
392
|
+
# ```
|
393
|
+
#
|
394
|
+
# Will be corrected as:
|
395
|
+
#
|
396
|
+
# ```ruby
|
397
|
+
# class Foo; end
|
398
|
+
# ```
|
399
|
+
#
|
400
|
+
# Other comments or magic comments are left in place.
|
401
|
+
class RuboCop::Cop::Sorbet::EnforceSingleSigil < ::RuboCop::Cop::Sorbet::ValidSigil
|
402
|
+
include ::RuboCop::Cop::RangeHelp
|
403
|
+
|
404
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/enforce_single_sigil.rb#39
|
405
|
+
def autocorrect(_node); end
|
406
|
+
|
407
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/enforce_single_sigil.rb#29
|
408
|
+
def investigate(processed_source); end
|
409
|
+
|
410
|
+
protected
|
411
|
+
|
412
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/enforce_single_sigil.rb#55
|
413
|
+
def extract_all_sigils(processed_source); end
|
414
|
+
end
|
415
|
+
|
416
|
+
# This cop makes the Sorbet `false` sigil mandatory in all files.
|
417
|
+
class RuboCop::Cop::Sorbet::FalseSigil < ::RuboCop::Cop::Sorbet::HasSigil
|
418
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/false_sigil.rb#11
|
419
|
+
def minimum_strictness; end
|
420
|
+
end
|
421
|
+
|
422
|
+
# This cop ensures RBI shims do not include a call to extend T::Sig
|
423
|
+
# or to extend T::Helpers
|
424
|
+
#
|
425
|
+
# @example
|
426
|
+
#
|
427
|
+
# # bad
|
428
|
+
# module SomeModule
|
429
|
+
# extend T::Sig
|
430
|
+
# extend T::Helpers
|
431
|
+
#
|
432
|
+
# sig { returns(String) }
|
433
|
+
# def foo; end
|
434
|
+
# end
|
435
|
+
#
|
436
|
+
# # good
|
437
|
+
# module SomeModule
|
438
|
+
# sig { returns(String) }
|
439
|
+
# def foo; end
|
440
|
+
# end
|
441
|
+
class RuboCop::Cop::Sorbet::ForbidExtendTSigHelpersInShims < ::RuboCop::Cop::Cop
|
442
|
+
include ::RuboCop::Cop::RangeHelp
|
443
|
+
|
444
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/rbi/forbid_extend_t_sig_helpers_in_shims.rb#39
|
445
|
+
def autocorrect(node); end
|
446
|
+
|
447
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/rbi/forbid_extend_t_sig_helpers_in_shims.rb#35
|
448
|
+
def extend_t_helpers?(param0 = T.unsafe(nil)); end
|
449
|
+
|
450
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/rbi/forbid_extend_t_sig_helpers_in_shims.rb#31
|
451
|
+
def extend_t_sig?(param0 = T.unsafe(nil)); end
|
452
|
+
|
453
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/rbi/forbid_extend_t_sig_helpers_in_shims.rb#47
|
454
|
+
def on_send(node); end
|
455
|
+
end
|
456
|
+
|
457
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/rbi/forbid_extend_t_sig_helpers_in_shims.rb#28
|
458
|
+
RuboCop::Cop::Sorbet::ForbidExtendTSigHelpersInShims::MSG = T.let(T.unsafe(nil), String)
|
459
|
+
|
460
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/rbi/forbid_extend_t_sig_helpers_in_shims.rb#29
|
461
|
+
RuboCop::Cop::Sorbet::ForbidExtendTSigHelpersInShims::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
462
|
+
|
463
|
+
class RuboCop::Cop::Sorbet::ForbidIncludeConstLiteral < ::RuboCop::Cop::Cop
|
464
|
+
# @return [ForbidIncludeConstLiteral] a new instance of ForbidIncludeConstLiteral
|
465
|
+
#
|
466
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_include_const_literal.rb#40
|
467
|
+
def initialize(*_arg0); end
|
468
|
+
|
469
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_include_const_literal.rb#56
|
470
|
+
def autocorrect(node); end
|
471
|
+
|
472
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_include_const_literal.rb#34
|
473
|
+
def not_lit_const_include?(param0 = T.unsafe(nil)); end
|
474
|
+
|
475
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_include_const_literal.rb#45
|
476
|
+
def on_send(node); end
|
477
|
+
|
478
|
+
# Returns the value of attribute used_names.
|
479
|
+
#
|
480
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_include_const_literal.rb#32
|
481
|
+
def used_names; end
|
482
|
+
|
483
|
+
# Sets the attribute used_names
|
484
|
+
#
|
485
|
+
# @param value the value to set the attribute used_names to.
|
486
|
+
#
|
487
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_include_const_literal.rb#32
|
488
|
+
def used_names=(_arg0); end
|
489
|
+
end
|
490
|
+
|
491
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_include_const_literal.rb#30
|
492
|
+
RuboCop::Cop::Sorbet::ForbidIncludeConstLiteral::MSG = T.let(T.unsafe(nil), String)
|
493
|
+
|
494
|
+
# This cop makes sure that RBI files are always located under the defined allowed paths.
|
495
|
+
#
|
496
|
+
# Options:
|
497
|
+
#
|
498
|
+
# * `AllowedPaths`: A list of the paths where RBI files are allowed (default: ["sorbet/rbi/**"])
|
499
|
+
#
|
500
|
+
# @example
|
501
|
+
# # bad
|
502
|
+
# # lib/some_file.rbi
|
503
|
+
# # other_file.rbi
|
504
|
+
#
|
505
|
+
# # good
|
506
|
+
# # sorbet/rbi/some_file.rbi
|
507
|
+
# # sorbet/rbi/any/path/for/file.rbi
|
508
|
+
class RuboCop::Cop::Sorbet::ForbidRBIOutsideOfAllowedPaths < ::RuboCop::Cop::Cop
|
509
|
+
include ::RuboCop::Cop::RangeHelp
|
510
|
+
|
511
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/rbi/forbid_rbi_outside_of_allowed_paths.rb#25
|
512
|
+
def investigate(processed_source); end
|
513
|
+
|
514
|
+
private
|
515
|
+
|
516
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/rbi/forbid_rbi_outside_of_allowed_paths.rb#57
|
517
|
+
def allowed_paths; end
|
518
|
+
end
|
519
|
+
|
520
|
+
class RuboCop::Cop::Sorbet::ForbidSuperclassConstLiteral < ::RuboCop::Cop::Cop
|
521
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_superclass_const_literal.rb#30
|
522
|
+
def not_lit_const_superclass?(param0 = T.unsafe(nil)); end
|
523
|
+
|
524
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_superclass_const_literal.rb#38
|
525
|
+
def on_class(node); end
|
526
|
+
end
|
527
|
+
|
528
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_superclass_const_literal.rb#28
|
529
|
+
RuboCop::Cop::Sorbet::ForbidSuperclassConstLiteral::MSG = T.let(T.unsafe(nil), String)
|
530
|
+
|
531
|
+
# This cop disallows using `T.unsafe` anywhere.
|
532
|
+
#
|
533
|
+
# @example
|
534
|
+
#
|
535
|
+
# # bad
|
536
|
+
# T.unsafe(foo)
|
537
|
+
#
|
538
|
+
# # good
|
539
|
+
# foo
|
540
|
+
class RuboCop::Cop::Sorbet::ForbidTUnsafe < ::RuboCop::Cop::Cop
|
541
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_t_unsafe.rb#20
|
542
|
+
def on_send(node); end
|
543
|
+
|
544
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_t_unsafe.rb#18
|
545
|
+
def t_unsafe?(param0 = T.unsafe(nil)); end
|
546
|
+
end
|
547
|
+
|
548
|
+
# This cop disallows using `T.untyped` anywhere.
|
549
|
+
#
|
550
|
+
# @example
|
551
|
+
#
|
552
|
+
# # bad
|
553
|
+
# sig { params(my_argument: T.untyped).void }
|
554
|
+
# def foo(my_argument); end
|
555
|
+
#
|
556
|
+
# # good
|
557
|
+
# sig { params(my_argument: String).void }
|
558
|
+
# def foo(my_argument); end
|
559
|
+
class RuboCop::Cop::Sorbet::ForbidTUntyped < ::RuboCop::Cop::Cop
|
560
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_t_untyped.rb#23
|
561
|
+
def on_send(node); end
|
562
|
+
|
563
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_t_untyped.rb#21
|
564
|
+
def t_untyped?(param0 = T.unsafe(nil)); end
|
565
|
+
end
|
566
|
+
|
567
|
+
# This cop disallows use of `T.untyped` or `T.nilable(T.untyped)`
|
568
|
+
# as a prop type for `T::Struct`.
|
569
|
+
#
|
570
|
+
# @example
|
571
|
+
#
|
572
|
+
# # bad
|
573
|
+
# class SomeClass
|
574
|
+
# const :foo, T.untyped
|
575
|
+
# prop :bar, T.nilable(T.untyped)
|
576
|
+
# end
|
577
|
+
#
|
578
|
+
# # good
|
579
|
+
# class SomeClass
|
580
|
+
# const :foo, Integer
|
581
|
+
# prop :bar, T.nilable(String)
|
582
|
+
# end
|
583
|
+
class RuboCop::Cop::Sorbet::ForbidUntypedStructProps < ::RuboCop::Cop::Cop
|
584
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_untyped_struct_props.rb#48
|
585
|
+
def on_class(node); end
|
586
|
+
|
587
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_untyped_struct_props.rb#40
|
588
|
+
def subclass_of_t_struct?(param0 = T.unsafe(nil)); end
|
589
|
+
|
590
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_untyped_struct_props.rb#36
|
591
|
+
def t_nilable_untyped(param0 = T.unsafe(nil)); end
|
592
|
+
|
593
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_untyped_struct_props.rb#28
|
594
|
+
def t_struct(param0 = T.unsafe(nil)); end
|
595
|
+
|
596
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_untyped_struct_props.rb#32
|
597
|
+
def t_untyped(param0 = T.unsafe(nil)); end
|
598
|
+
|
599
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_untyped_struct_props.rb#44
|
600
|
+
def untyped_props(param0); end
|
601
|
+
end
|
602
|
+
|
603
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/forbid_untyped_struct_props.rb#26
|
604
|
+
RuboCop::Cop::Sorbet::ForbidUntypedStructProps::MSG = T.let(T.unsafe(nil), String)
|
605
|
+
|
606
|
+
# This cop makes the Sorbet typed sigil mandatory in all files.
|
607
|
+
#
|
608
|
+
# Options:
|
609
|
+
#
|
610
|
+
# * `SuggestedStrictness`: Sorbet strictness level suggested in offense messages (default: 'false')
|
611
|
+
# * `MinimumStrictness`: If set, make offense if the strictness level in the file is below this one
|
612
|
+
#
|
613
|
+
# If a `MinimumStrictness` level is specified, it will be used in offense messages and autocorrect.
|
614
|
+
class RuboCop::Cop::Sorbet::HasSigil < ::RuboCop::Cop::Sorbet::ValidSigil
|
615
|
+
# @return [Boolean]
|
616
|
+
#
|
617
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/has_sigil.rb#20
|
618
|
+
def require_sigil_on_all_files?; end
|
619
|
+
end
|
620
|
+
|
621
|
+
# This cop makes the Sorbet `ignore` sigil mandatory in all files.
|
622
|
+
class RuboCop::Cop::Sorbet::IgnoreSigil < ::RuboCop::Cop::Sorbet::HasSigil
|
623
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/ignore_sigil.rb#11
|
624
|
+
def minimum_strictness; end
|
625
|
+
end
|
626
|
+
|
627
|
+
# This cop checks for the ordering of keyword arguments required by
|
628
|
+
# sorbet-runtime. The ordering requires that all keyword arguments
|
629
|
+
# are at the end of the parameters list, and all keyword arguments
|
630
|
+
# with a default value must be after those without default values.
|
631
|
+
#
|
632
|
+
# @example
|
633
|
+
#
|
634
|
+
# # bad
|
635
|
+
# sig { params(a: Integer, b: String).void }
|
636
|
+
# def foo(a: 1, b:); end
|
637
|
+
#
|
638
|
+
# # good
|
639
|
+
# sig { params(b: String, a: Integer).void }
|
640
|
+
# def foo(b:, a: 1); end
|
641
|
+
class RuboCop::Cop::Sorbet::KeywordArgumentOrdering < ::RuboCop::Cop::Sorbet::SignatureCop
|
642
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/keyword_argument_ordering.rb#24
|
643
|
+
def on_signature(node); end
|
644
|
+
|
645
|
+
private
|
646
|
+
|
647
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/keyword_argument_ordering.rb#34
|
648
|
+
def check_order_for_kwoptargs(parameters); end
|
649
|
+
end
|
650
|
+
|
651
|
+
module RuboCop::Cop::Sorbet::MutableConstantSorbetAwareBehaviour
|
652
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/mutable_constant_sorbet_aware_behaviour.rb#15
|
653
|
+
def on_assignment(value); end
|
654
|
+
|
655
|
+
class << self
|
656
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/mutable_constant_sorbet_aware_behaviour.rb#9
|
657
|
+
def prepended(base); end
|
658
|
+
end
|
659
|
+
end
|
660
|
+
|
661
|
+
# This cop ensures one ancestor per requires_ancestor line
|
662
|
+
# rather than chaining them as a comma-separated list.
|
663
|
+
#
|
664
|
+
# @example
|
665
|
+
#
|
666
|
+
# # bad
|
667
|
+
# module SomeModule
|
668
|
+
# requires_ancestor Kernel, Minitest::Assertions
|
669
|
+
# end
|
670
|
+
#
|
671
|
+
# # good
|
672
|
+
# module SomeModule
|
673
|
+
# requires_ancestor Kernel
|
674
|
+
# requires_ancestor Minitest::Assertions
|
675
|
+
# end
|
676
|
+
class RuboCop::Cop::Sorbet::OneAncestorPerLine < ::RuboCop::Cop::Cop
|
677
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/one_ancestor_per_line.rb#35
|
678
|
+
def abstract?(param0); end
|
679
|
+
|
680
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/one_ancestor_per_line.rb#51
|
681
|
+
def autocorrect(node); end
|
682
|
+
|
683
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/one_ancestor_per_line.rb#31
|
684
|
+
def more_than_one_ancestor(param0 = T.unsafe(nil)); end
|
685
|
+
|
686
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/one_ancestor_per_line.rb#45
|
687
|
+
def on_class(node); end
|
688
|
+
|
689
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/one_ancestor_per_line.rb#39
|
690
|
+
def on_module(node); end
|
691
|
+
|
692
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/one_ancestor_per_line.rb#27
|
693
|
+
def requires_ancestors(param0); end
|
694
|
+
|
695
|
+
private
|
696
|
+
|
697
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/one_ancestor_per_line.rb#67
|
698
|
+
def new_ra_line(indent_count); end
|
699
|
+
|
700
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/one_ancestor_per_line.rb#61
|
701
|
+
def process_node(node); end
|
702
|
+
end
|
703
|
+
|
704
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/one_ancestor_per_line.rb#25
|
705
|
+
RuboCop::Cop::Sorbet::OneAncestorPerLine::MSG = T.let(T.unsafe(nil), String)
|
706
|
+
|
707
|
+
class RuboCop::Cop::Sorbet::SignatureBuildOrder < ::RuboCop::Cop::Sorbet::SignatureCop
|
708
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/signature_build_order.rb#54
|
709
|
+
def autocorrect(node); end
|
710
|
+
|
711
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/signature_build_order.rb#34
|
712
|
+
def on_signature(node); end
|
713
|
+
|
714
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/signature_build_order.rb#30
|
715
|
+
def root_call(param0); end
|
716
|
+
|
717
|
+
private
|
718
|
+
|
719
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/signature_build_order.rb#96
|
720
|
+
def call_chain(sig_child_node); end
|
721
|
+
|
722
|
+
# @return [Boolean]
|
723
|
+
#
|
724
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/signature_build_order.rb#92
|
725
|
+
def can_autocorrect?; end
|
726
|
+
|
727
|
+
# This method exists to reparse the current node with modern features enabled.
|
728
|
+
# Modern features include "index send" emitting, which is necessary to unparse
|
729
|
+
# "index sends" (i.e. `[]` calls) back to index accessors (i.e. as `foo[bar]``).
|
730
|
+
# Otherwise, we would get the unparsed node as `foo.[](bar)`.
|
731
|
+
#
|
732
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/signature_build_order.rb#83
|
733
|
+
def node_reparsed_with_modern_features(node); end
|
734
|
+
end
|
735
|
+
|
736
|
+
# Create a subclass of AST Builder that has modern features turned on
|
737
|
+
class RuboCop::Cop::Sorbet::SignatureBuildOrder::ModernBuilder < ::RuboCop::AST::Builder; end
|
738
|
+
|
739
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/signature_build_order.rb#16
|
740
|
+
RuboCop::Cop::Sorbet::SignatureBuildOrder::ORDER = T.let(T.unsafe(nil), Hash)
|
741
|
+
|
742
|
+
# Abstract cop specific to Sorbet signatures
|
743
|
+
#
|
744
|
+
# You can subclass it to use the `on_signature` trigger and the `signature?` node matcher.
|
745
|
+
class RuboCop::Cop::Sorbet::SignatureCop < ::RuboCop::Cop::Cop
|
746
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/signature_cop.rb#26
|
747
|
+
def allowed_recv(recv); end
|
748
|
+
|
749
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/signature_cop.rb#33
|
750
|
+
def on_block(node); end
|
751
|
+
|
752
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/signature_cop.rb#37
|
753
|
+
def on_signature(_); end
|
754
|
+
|
755
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/signature_cop.rb#14
|
756
|
+
def signature?(param0 = T.unsafe(nil)); end
|
757
|
+
|
758
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/signature_cop.rb#18
|
759
|
+
def with_runtime?(param0 = T.unsafe(nil)); end
|
760
|
+
|
761
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/signatures/signature_cop.rb#22
|
762
|
+
def without_runtime?(param0 = T.unsafe(nil)); end
|
763
|
+
end
|
764
|
+
|
765
|
+
# This cop ensures empty class/module definitions in RBI files are
|
766
|
+
# done on a single line rather than being split across multiple lines.
|
767
|
+
#
|
768
|
+
# @example
|
769
|
+
#
|
770
|
+
# # bad
|
771
|
+
# module SomeModule
|
772
|
+
# end
|
773
|
+
#
|
774
|
+
# # good
|
775
|
+
# module SomeModule; end
|
776
|
+
class RuboCop::Cop::Sorbet::SingleLineRbiClassModuleDefinitions < ::RuboCop::Cop::Cop
|
777
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/rbi/single_line_rbi_class_module_definitions.rb#28
|
778
|
+
def autocorrect(node); end
|
779
|
+
|
780
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/rbi/single_line_rbi_class_module_definitions.rb#24
|
781
|
+
def on_class(node); end
|
782
|
+
|
783
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/rbi/single_line_rbi_class_module_definitions.rb#20
|
784
|
+
def on_module(node); end
|
785
|
+
|
786
|
+
protected
|
787
|
+
|
788
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/rbi/single_line_rbi_class_module_definitions.rb#34
|
789
|
+
def convert_newlines(source); end
|
790
|
+
|
791
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/rbi/single_line_rbi_class_module_definitions.rb#38
|
792
|
+
def process_node(node); end
|
793
|
+
end
|
794
|
+
|
795
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/rbi/single_line_rbi_class_module_definitions.rb#18
|
796
|
+
RuboCop::Cop::Sorbet::SingleLineRbiClassModuleDefinitions::MSG = T.let(T.unsafe(nil), String)
|
797
|
+
|
798
|
+
# This cop makes the Sorbet `strict` sigil mandatory in all files.
|
799
|
+
class RuboCop::Cop::Sorbet::StrictSigil < ::RuboCop::Cop::Sorbet::HasSigil
|
800
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/strict_sigil.rb#11
|
801
|
+
def minimum_strictness; end
|
802
|
+
end
|
803
|
+
|
804
|
+
# This cop makes the Sorbet `strong` sigil mandatory in all files.
|
805
|
+
class RuboCop::Cop::Sorbet::StrongSigil < ::RuboCop::Cop::Sorbet::HasSigil
|
806
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/strong_sigil.rb#11
|
807
|
+
def minimum_strictness; end
|
808
|
+
end
|
809
|
+
|
810
|
+
# This cop makes the Sorbet `true` sigil mandatory in all files.
|
811
|
+
class RuboCop::Cop::Sorbet::TrueSigil < ::RuboCop::Cop::Sorbet::HasSigil
|
812
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/true_sigil.rb#11
|
813
|
+
def minimum_strictness; end
|
814
|
+
end
|
815
|
+
|
816
|
+
# This cop ensures all constants used as `T.type_alias` are using CamelCase.
|
817
|
+
#
|
818
|
+
# @example
|
819
|
+
#
|
820
|
+
# # bad
|
821
|
+
# FOO_OR_BAR = T.type_alias { T.any(Foo, Bar) }
|
822
|
+
#
|
823
|
+
# # good
|
824
|
+
# FooOrBar = T.type_alias { T.any(Foo, Bar) }
|
825
|
+
class RuboCop::Cop::Sorbet::TypeAliasName < ::RuboCop::Cop::Cop
|
826
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/type_alias_name.rb#20
|
827
|
+
def casgn_type_alias?(param0 = T.unsafe(nil)); end
|
828
|
+
|
829
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/type_alias_name.rb#32
|
830
|
+
def on_casgn(node); end
|
831
|
+
end
|
832
|
+
|
833
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/type_alias_name.rb#18
|
834
|
+
RuboCop::Cop::Sorbet::TypeAliasName::MSG = T.let(T.unsafe(nil), String)
|
835
|
+
|
836
|
+
# This cop checks that every Ruby file contains a valid Sorbet sigil.
|
837
|
+
# Adapted from: https://gist.github.com/clarkdave/85aca4e16f33fd52aceb6a0a29936e52
|
838
|
+
#
|
839
|
+
# Options:
|
840
|
+
#
|
841
|
+
# * `RequireSigilOnAllFiles`: make offense if the Sorbet typed is not found in the file (default: false)
|
842
|
+
# * `SuggestedStrictness`: Sorbet strictness level suggested in offense messages (default: 'false')
|
843
|
+
# * `MinimumStrictness`: If set, make offense if the strictness level in the file is below this one
|
844
|
+
#
|
845
|
+
# If a `MinimumStrictness` level is specified, it will be used in offense messages and autocorrect.
|
846
|
+
class RuboCop::Cop::Sorbet::ValidSigil < ::RuboCop::Cop::Cop
|
847
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/valid_sigil.rb#33
|
848
|
+
def autocorrect(_node); end
|
849
|
+
|
850
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/valid_sigil.rb#21
|
851
|
+
def investigate(processed_source); end
|
852
|
+
|
853
|
+
protected
|
854
|
+
|
855
|
+
# checks
|
856
|
+
#
|
857
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/valid_sigil.rb#68
|
858
|
+
def check_sigil_present(sigil); end
|
859
|
+
|
860
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/valid_sigil.rb#125
|
861
|
+
def check_strictness_level(sigil, strictness); end
|
862
|
+
|
863
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/valid_sigil.rb#103
|
864
|
+
def check_strictness_not_empty(sigil, strictness); end
|
865
|
+
|
866
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/valid_sigil.rb#114
|
867
|
+
def check_strictness_valid(sigil, strictness); end
|
868
|
+
|
869
|
+
# extraction
|
870
|
+
#
|
871
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/valid_sigil.rb#56
|
872
|
+
def extract_sigil(processed_source); end
|
873
|
+
|
874
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/valid_sigil.rb#62
|
875
|
+
def extract_strictness(sigil); end
|
876
|
+
|
877
|
+
# Default is `nil`
|
878
|
+
#
|
879
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/valid_sigil.rb#155
|
880
|
+
def minimum_strictness; end
|
881
|
+
|
882
|
+
# Default is `false`
|
883
|
+
#
|
884
|
+
# @return [Boolean]
|
885
|
+
#
|
886
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/valid_sigil.rb#144
|
887
|
+
def require_sigil_on_all_files?; end
|
888
|
+
|
889
|
+
# Default is `'false'`
|
890
|
+
#
|
891
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/valid_sigil.rb#149
|
892
|
+
def suggested_strictness; end
|
893
|
+
|
894
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/valid_sigil.rb#84
|
895
|
+
def suggested_strictness_level(minimum_strictness, suggested_strictness); end
|
896
|
+
end
|
897
|
+
|
898
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/valid_sigil.rb#52
|
899
|
+
RuboCop::Cop::Sorbet::ValidSigil::SIGIL_REGEX = T.let(T.unsafe(nil), Regexp)
|
900
|
+
|
901
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/sigils/valid_sigil.rb#51
|
902
|
+
RuboCop::Cop::Sorbet::ValidSigil::STRICTNESS_LEVELS = T.let(T.unsafe(nil), Array)
|
903
|
+
|
904
|
+
module RuboCop::Cop::Style; end
|
905
|
+
|
906
|
+
class RuboCop::Cop::Style::MutableConstant < ::RuboCop::Cop::Base
|
907
|
+
include ::RuboCop::Cop::Sorbet::MutableConstantSorbetAwareBehaviour
|
908
|
+
include ::RuboCop::Cop::Style::MutableConstant::ShareableConstantValue
|
909
|
+
include ::RuboCop::Cop::FrozenStringLiteral
|
910
|
+
include ::RuboCop::Cop::ConfigurableEnforcedStyle
|
911
|
+
extend ::RuboCop::Cop::AutoCorrector
|
912
|
+
|
913
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/mutable_constant_sorbet_aware_behaviour.rb#15
|
914
|
+
def on_assignment(value); end
|
915
|
+
|
916
|
+
# source://rubocop/1.40.0/lib/rubocop/cop/style/mutable_constant.rb#127
|
917
|
+
def on_casgn(node); end
|
918
|
+
|
919
|
+
# source://rubocop/1.40.0/lib/rubocop/cop/style/mutable_constant.rb#224
|
920
|
+
def operation_produces_immutable_object?(param0 = T.unsafe(nil)); end
|
921
|
+
|
922
|
+
# source://rubocop/1.40.0/lib/rubocop/cop/style/mutable_constant.rb#241
|
923
|
+
def range_enclosed_in_parentheses?(param0 = T.unsafe(nil)); end
|
924
|
+
|
925
|
+
# source://rubocop/1.40.0/lib/rubocop/cop/style/mutable_constant.rb#217
|
926
|
+
def splat_value(param0 = T.unsafe(nil)); end
|
927
|
+
|
928
|
+
# source://rubocop-sorbet//lib/rubocop/cop/sorbet/mutable_constant_sorbet_aware_behaviour.rb#10
|
929
|
+
def t_let(param0 = T.unsafe(nil)); end
|
930
|
+
|
931
|
+
private
|
932
|
+
|
933
|
+
# source://rubocop/1.40.0/lib/rubocop/cop/style/mutable_constant.rb#169
|
934
|
+
def autocorrect(corrector, node); end
|
935
|
+
|
936
|
+
# source://rubocop/1.40.0/lib/rubocop/cop/style/mutable_constant.rb#158
|
937
|
+
def check(value); end
|
938
|
+
|
939
|
+
# source://rubocop/1.40.0/lib/rubocop/cop/style/mutable_constant.rb#208
|
940
|
+
def correct_splat_expansion(corrector, expr, splat_value); end
|
941
|
+
|
942
|
+
# source://rubocop/1.40.0/lib/rubocop/cop/style/mutable_constant.rb#200
|
943
|
+
def frozen_regexp_or_range_literals?(node); end
|
944
|
+
|
945
|
+
# source://rubocop/1.40.0/lib/rubocop/cop/style/mutable_constant.rb#190
|
946
|
+
def immutable_literal?(node); end
|
947
|
+
|
948
|
+
# source://rubocop/1.40.0/lib/rubocop/cop/style/mutable_constant.rb#184
|
949
|
+
def mutable_literal?(value); end
|
950
|
+
|
951
|
+
# source://rubocop/1.40.0/lib/rubocop/cop/style/mutable_constant.rb#204
|
952
|
+
def requires_parentheses?(node); end
|
953
|
+
|
954
|
+
# source://rubocop/1.40.0/lib/rubocop/cop/style/mutable_constant.rb#194
|
955
|
+
def shareable_constant_value?(node); end
|
956
|
+
|
957
|
+
# source://rubocop/1.40.0/lib/rubocop/cop/style/mutable_constant.rb#149
|
958
|
+
def strict_check(value); end
|
959
|
+
end
|
960
|
+
|
961
|
+
# source://rubocop/1.40.0/lib/rubocop/cop/style/mutable_constant.rb#125
|
962
|
+
RuboCop::Cop::Style::MutableConstant::MSG = T.let(T.unsafe(nil), String)
|
963
|
+
|
964
|
+
class RuboCop::Error < ::StandardError; end
|
965
|
+
class RuboCop::IncorrectCopNameError < ::StandardError; end
|
966
|
+
|
967
|
+
# source://rubocop/1.40.0/lib/rubocop/ast_aliases.rb#5
|
968
|
+
RuboCop::NodePattern = RuboCop::AST::NodePattern
|
969
|
+
|
970
|
+
class RuboCop::OptionArgumentError < ::StandardError; end
|
971
|
+
module RuboCop::OptionsHelp; end
|
972
|
+
|
973
|
+
# source://rubocop/1.40.0/lib/rubocop/options.rb#470
|
974
|
+
RuboCop::OptionsHelp::FORMATTER_OPTION_LIST = T.let(T.unsafe(nil), Array)
|
975
|
+
|
976
|
+
# source://rubocop/1.40.0/lib/rubocop/options.rb#469
|
977
|
+
RuboCop::OptionsHelp::MAX_EXCL = T.let(T.unsafe(nil), String)
|
978
|
+
|
979
|
+
# source://rubocop/1.40.0/lib/rubocop/options.rb#472
|
980
|
+
RuboCop::OptionsHelp::TEXT = T.let(T.unsafe(nil), Hash)
|
981
|
+
|
982
|
+
# source://rubocop/1.40.0/lib/rubocop/ast_aliases.rb#6
|
983
|
+
RuboCop::ProcessedSource = RuboCop::AST::ProcessedSource
|
984
|
+
|
985
|
+
module RuboCop::Sorbet; end
|
986
|
+
|
987
|
+
# source://rubocop-sorbet//lib/rubocop/sorbet.rb#11
|
988
|
+
RuboCop::Sorbet::CONFIG = T.let(T.unsafe(nil), Hash)
|
989
|
+
|
990
|
+
# source://rubocop-sorbet//lib/rubocop/sorbet.rb#10
|
991
|
+
RuboCop::Sorbet::CONFIG_DEFAULT = T.let(T.unsafe(nil), Pathname)
|
992
|
+
|
993
|
+
class RuboCop::Sorbet::Error < ::StandardError; end
|
994
|
+
|
995
|
+
# Because RuboCop doesn't yet support plugins, we have to monkey patch in a
|
996
|
+
# bit of our configuration.
|
997
|
+
module RuboCop::Sorbet::Inject
|
998
|
+
class << self
|
999
|
+
# source://rubocop-sorbet//lib/rubocop/sorbet/inject.rb#10
|
1000
|
+
def defaults!; end
|
1001
|
+
end
|
1002
|
+
end
|
1003
|
+
|
1004
|
+
# source://rubocop-sorbet//lib/rubocop/sorbet.rb#9
|
1005
|
+
RuboCop::Sorbet::PROJECT_ROOT = T.let(T.unsafe(nil), Pathname)
|
1006
|
+
|
1007
|
+
# source://rubocop-sorbet//lib/rubocop/sorbet/version.rb#4
|
1008
|
+
RuboCop::Sorbet::VERSION = T.let(T.unsafe(nil), String)
|
1009
|
+
|
1010
|
+
# source://rubocop/1.40.0/lib/rubocop/ast_aliases.rb#7
|
1011
|
+
RuboCop::Token = RuboCop::AST::Token
|
1012
|
+
|
1013
|
+
class RuboCop::ValidationError < ::RuboCop::Error; end
|
1014
|
+
class RuboCop::Warning < ::StandardError; end
|